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

Using factors in IF statement - yields incorrect Totals

Hello experts,

 

I have a question about one of the calculations that I am doing. Suppose, I have 4 products , their grouping and sales value. I have to apply factors for each product. See below table.

 

GroupProductValueFactorValue_Display
1A1001100
1B2000.5100
2C3000.75225
2D4001400
Total 1000 825

 

 

Now, I am using the calculated measure to get the Value_display as below. I get the correct value for the value display but my “Totals” is incorrect. I am getting as “1000” instead of “825”. Also, I have show this in a matrix with hierarchy of Grouping -->Product which is also giving incorrect results.

Value_display =if((SELECTEDVALUE('Table'[Product])="B",0.5*[Value],

IF(SELECTEDVALUE('Table'[Product])="C",0.75*[Value],

[Value]))

 

Any help will be appreciated!

 

Thanks,

Lakshay

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

Is there a reason why the numbers are hardcoded in the DAX formula when they can be found in the table?

This measure should work:

MValue_display = SUMX(TableH, TableH[Factor] * TableH[Value])

View solution in original post

1 REPLY 1
HotChilli
Super User
Super User

Is there a reason why the numbers are hardcoded in the DAX formula when they can be found in the table?

This measure should work:

MValue_display = SUMX(TableH, TableH[Factor] * TableH[Value])

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.

Top Solution Authors