Help

IF statement is not working properly when comparing rollup results from two fields

4565 12
cancel
Showing results for 
Search instead for 
Did you mean: 
Hector_Santilla
5 - Automation Enthusiast
5 - Automation Enthusiast

I am getting the MIN and AVE of two fields from a table using the rollup function. When I use the expression IF to compare the rollup results, the IF statement delivers wrong information. Please, some one help

12 Replies 12
Tim_Bourguignon
6 - Interface Innovator
6 - Interface Innovator

Hi @Hector_Santillan, happy to help. Can you please provide more information? What are you trying to do? What does your formula looks like? In what way is the result wrong? Maybe you can add a screenshot?

Hector_Santilla
5 - Automation Enthusiast
5 - Automation Enthusiast

Yes, thank you for your reply.

I have a currency field. During a week, I want to know if that field has change. In order to do that I use the rollup function AVE and MIN. If the AVE and MIN are the same, then the currency field has not change, otherwise the field changed.
When I use the formula IF ((AvePrevWage = MinPrevWage), yes, no) the result is always no, even though the AvePrevWage and MinPrevWage fields have the same value.

I’ll bet they aren’t the same value. My hunch is the values (especially the averaged value) are far different from what you are rendering in that field. Consider how averages work - they are deeply fractionalized, so the likelihood they are slightly different, is great.

I recommend you test my hypothesis by simply increasing the decimals for the values in the table to see if they are really the same at deeper precisions.

Hector_Santilla
5 - Automation Enthusiast
5 - Automation Enthusiast

Thanks, Bill.

I adjusted the decimals to the max permitted, but the results are the same. Any other options, or any idea on how to detect in the values changed during a week, instead of using the listed method? ThanksScreen Shot 2019-09-30 at 5.49.12 PM.png

Hmmm, I was almost certain that was the issue.

Um, have you tested your formula on two fields that are number types instead of rollup types just to be sure the formula is valid?

Unfortunately, here’s what I get when I duplicate your code:

RollupCompTest

Are you using a self-linked table, by any chance – that is, are {AvePrevWage} and {MinPrevWage}. rolled up from the same table in which you are performing the calculation, or are they rolled from links to another table?

nea_lpatil
7 - App Architect
7 - App Architect

@Hector_Santillan

I think following is happening.

@Bill.French is right. Both the numbers compared are not the same.

Decimal point number formatting limitation causes this problem for showing that two numbers are same.
Just multiply difference of two numbers by big number e.g. 10Billion as I did in my test below and it will display number which is not zero. It means that two numbers are different.

Please note that I converted text into number to preserve decimal points beyond default precision of 8.
I am using two numbers for comparison.
1.123456789
1.12345679

Hector_Santillan decimal_point_test.JPG

I need to look into data of @W_Vann_Hall to find out more about data used in the test because formula is the same but data might be different from Hector.

Neal

{AvePrevWage} and {MinPrevWage} are coming from different table, not from where the calculations are done.

The field {PrevWage} are formatted in currency values at the original table