Salesforce and other SMB Solutions are coming soon. ×

# Having difficulty with IF, result 2 not calculating

## 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

##### 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

)

##### 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!

##### 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 …

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 …

## Join the conversation

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×

• ### Images

• 0
By Soliant Consulting,
• 0
By Soliant Consulting,
• 0
By Soliant Consulting,
• ### Forum Statistics

• Total Topics
33.6k
• Total Posts
141.5k
×
×
• Create New...