Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Comparison using AddColumns

image.png

I am using the formula below to determine which is greater (the EOC ACT or the SRO FCST). It then adds the Greater Value to the CM Factored ACT column. As you can see this particular project is not working for the 3RD Party category. But the formula does work properly for other projects (ones that have a value in the SRO FCST column). My guess is that since SRO FCST for 3rd Party does not exist for this project, the formula has nothing to compare EOC ACT to and therefore leaves it blank. What can I add to the formula to say if there is nothing to compare to just use EOC ACT? I tried adding an IFERROR around the existing IF but no change. 

 

Greater Value = SUMX(Addcolumns('SRO DATA',"ACT",'EOC DATA'[EOC NonLabor],"FCST",'SRO DATA'[SRO NonLabor]),IF([ACT]>[FCST],[ACT],[FCST]))

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

HI, @Anonymous

First, reason for the wrong result is My guess is that since SRO FCST for 3rd Party does not exist for this project, the formula has nothing to compare EOC ACT to and therefore leaves it blank.

Second,  What can I add to the formula to say if there is nothing to compare to just use EOC ACT?

You need to add a fact EOC_Type table then using addcolumns function 

Greater Value = SUMX(Addcolumns('EOC_Type',"ACT",'EOC DATA'[EOC NonLabor],"FCST",'SRO DATA'[SRO NonLabor]),IF([ACT]>[FCST],[ACT],[FCST]))

Thrid, you could just use this simple formula

Greater Value =
IF (
    'EOC DATA'[EOC NonLabor] > 'SRO DATA'[SRO NonLabor],
    'EOC DATA'[EOC NonLabor],
    'SRO DATA'[SRO NonLabor]
)

 

Best Regards,

Lin

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

HI, @Anonymous

First, reason for the wrong result is My guess is that since SRO FCST for 3rd Party does not exist for this project, the formula has nothing to compare EOC ACT to and therefore leaves it blank.

Second,  What can I add to the formula to say if there is nothing to compare to just use EOC ACT?

You need to add a fact EOC_Type table then using addcolumns function 

Greater Value = SUMX(Addcolumns('EOC_Type',"ACT",'EOC DATA'[EOC NonLabor],"FCST",'SRO DATA'[SRO NonLabor]),IF([ACT]>[FCST],[ACT],[FCST]))

Thrid, you could just use this simple formula

Greater Value =
IF (
    'EOC DATA'[EOC NonLabor] > 'SRO DATA'[SRO NonLabor],
    'EOC DATA'[EOC NonLabor],
    'SRO DATA'[SRO NonLabor]
)

 

Best Regards,

Lin

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

 Hi v-lili6-msft

I did try using the simpler formula you mentioned but the problem with it is that the totals are not the sum of all the lines - the totals do the same formula at a total level; therefore, the total always equals SRO FCST. 

Using your other suggestion of adding a fact EOC_TYPE table did work though. Thank you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.