Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Having difficulty with IF, result 2 not calculating


BadHamster
 Share

Recommended Posts

Hi,

 

Just signed up as ive been bashing my head against my table trying to figure out why a simple IF calculation is not working.

 

Basically I have an invoicing database and i want the TOTAL field to have a calculation to calculate the different rate of pay if a 7th day is worked. the way i approached it was to do an if calculation, if totday days worked is less that 6 then calculate total in result one, if 7 days are worked calculate total in the way laid out in result 2. Have i totally missed something here?

 

my current calculation is this, the result 1 works fine, but the result 2 is totally ignored.

 

If ( Time Sheet::Total Days Worked = 0

 

Please help!!!

Link to comment
Share on other sites

This

 

Time Sheet::Total Days Worked = 0

 

doesn't make sense, and – if Total is the name of the very calculation field you're defining here – neither does this:

 

Total= ( Daily Salary*8 ) …

 

You don't have to (and usually can't) include the field name itself in the calculation

 

Try this; adapt the factor calculation as required.

 

Let ( [

totalUnfactored = Box Rental + Per diems total + Over Time Total + ten hour OT total + Car rental ;

daysWorked = Sheet::Total Days Worked ;

factor = Case ( daysWorked

] ;

totalUnfactored * factor

)

Link to comment
Share on other sites

I COULD KISS YOU!!!

 

Thanks for this. Unfortunatley it was still a little off, but broke down your idea to idiot levels that i could understand and made a new field just for weekly base salary total and used the below script based off yours -

 

Let ( [

Total Weekly base salaryUnfactored = Daily Salary;

daysWorked = Time Sheet::Total Days Worked ;

factor = Case ( daysWorked

] ;

Total Weekly base salaryUnfactored * factor

)

 

I then had the total field being a sum of all the totals!

 

Thank you so much! :)

Link to comment
Share on other sites

Thanks for this. Unfortunatley it was still a little off

 

You're welcome – and yes, I forgot the dailySalary, but you did grasp the general idea of simplifying the calculation, so more power to you!

 

Let ( [

Total Weekly base salaryUnfactored = Daily Salary;

 

Another general idea is to use variable names that are simpler/shorter/clearer than the objects/expressions they refer to … :D

 

Also, if you're using the DailySalary field only once, there isn't really a need to put it into a variable at all:

 

Let ( [

daysWorked = Time Sheet::Total Days Worked ;

factor = Case ( daysWorked

] ;

Daily Salary * factor

)

 

Just saying …

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

Terms of Use