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

Wrong Sum of Total of a measure that evaluate to 1 or 0 with IF sentence?

I have this measure:

 

ColdSpotClm = IF(SUM(Test[Udbudte]) > 18 && [Belægningsprocent]<0,6;1;IF(SUM(Test[Udbudte]) >= 6 && SUM(Test[Udbudte])<=18 && [Belægningsprocent]<0,5;1;IF(SUM(Test[Udbudte]) >= 3 && SUM(Test[Udbudte])<= 5 && [Belægningsprocent]<0,4;1;0)))

 

Evaluates to 1 or 0 depending on the above condition. But the total is also evaluated were I would expect a sum of all the 1's. In the picture below measure is in the last column and evaluates each row correctly, but the sum is evaluated but I would expect it to show the sum 12. How to do that?

 

PowerBI2.png

4 REPLIES 4
v-yuezhe-msft
Employee
Employee

@Bokazoit,

Please create another measure in your table using DAX below and drag it to the table visual.

NewMeasure = IF(COUNTROWS(VALUES(Test[healthcentername]))=1, [ColdSpotClm],SUMX(VALUES(Test[healthcentername]),[ColdSpotClm]))


If the above measure doesn't return correct result, please share sample data of your table here.

Regards,
Lydia

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

I would rewrite the measure as a calculated column, and apply it there

of if it has to be a measure then use SUMX to get the total result of column added via ADDCOLUMN



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

How to rewrite to use the SUMX ? I tried and I can not use calculated column since I need to calcualted based on period interval

Stachu
Community Champion
Community Champion

can you share sample anonymised data, as well as syntax from the used measures? without it I can just give general advice as I did in the previous post



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

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.