Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
I have data like this
| Id | Amount | Flag |
| 1 | 10 | Yes |
| 2 | 20 | No |
| 3 | 30 | Yes |
| 4 | 40 | No |
| 5 | 50 | Yes |
| Total | 150 |
Amount and Flag are measures. I want to have other columns ValueswithYES, ValueswithNO and totals like this
| Id | Amount | Flag | ValueswithYES | ValueswithNO | |
| 1 | 10 | Yes | 10 | ||
| 2 | 20 | No | 20 | ||
| 3 | 30 | Yes | 30 | ||
| 4 | 40 | No | 40 | ||
| 5 | 50 | Yes | 50 | ||
| Total | 150 | Yes | 90 | 60 |
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?
Solved! Go to Solution.
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! |
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! |
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'?
Proud to be a Super User!
@bml123 - try as:
ValueswithYes Measure =
CALCULATE(
[Amount Measure],
TableName[Flag] = "Yes"
)
ValueswithYes Measure =
CALCULATE(
[Amount Measure],
TableName[Flag] = "No"
)
Proud to be a Super User!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.