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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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