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
bml123
Post Patron
Post Patron

Totals incorrect with measure

Hi,

 

I have data like this

 

IdAmountFlag
110Yes
220No
330Yes
440No
550Yes
Total150 

 

Amount and Flag are measures. I want to have other columns ValueswithYES, ValueswithNO and totals like this

 

 IdAmountFlagValueswithYESValueswithNO
 110Yes10 
 220No 20
 330Yes30 
 440No 40
 550Yes50 
Total 150Yes9060

 

I have used measures like this ValueswithYES = if(Flag="Yes",[Amount]), getting the values right but the total I am getting as 150 which is incorrect. How do I achieve this?

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

Values w/ YES = SUMX(VALUES(DATA[ID]),IF([Flag]="YES",[Amount]))

Values w/ NO = SUMX(VALUES(DATA[ID]),IF([Flag]="NO",[Amount]))

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

Values w/ YES = SUMX(VALUES(DATA[ID]),IF([Flag]="YES",[Amount]))

Values w/ NO = SUMX(VALUES(DATA[ID]),IF([Flag]="NO",[Amount]))

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

bml123
Post Patron
Post Patron

That didn't work. My Flag is also measure. 

Getting this error A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

What is the measure for 'Flag'?






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



ChrisMendoza
Resident Rockstar
Resident Rockstar

@bml123 - try as:

ValueswithYes Measure = 
CALCULATE(
    [Amount Measure],
    TableName[Flag] = "Yes"
)

ValueswithYes Measure = 
CALCULATE(
    [Amount Measure],
    TableName[Flag] = "No"
)

 

image.png






Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

Proud to be a Super User!



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.