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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JustinDoh1
Post Prodigy
Post Prodigy

Total comes out as zero (while using Switch statement)

I am sharing my Pbix file here.   

JustinDoh1_0-1629334014341.png

I am fairly new to DAX, and I tried SWITCH statement for the first time today.

Somehow, when there is any occurrence of outcome of 0, Total comes out to be 0.

So, on this case because Jane Doe has output of 0, total is 0.

But, somehow, it does not sum up as expected to 1.

 

I have only two examples here, but total should be 1 in this case.

 

I think there is something I need to fix on the DAX code, but I am not sure where/why.

This measure is called "Refused 0818" in the file.

 

The logic here is, when there is 1st case, output is 1, second case --> 0, third case --> 0, otherwise vRefused

Isn't it?

 

JustinDoh1_1-1629334284780.png

 

Thank you for any feedback.

 

3 REPLIES 3
JustinDoh1
Post Prodigy
Post Prodigy

@amitchandak I would like to follow up on my inquiries. I am anxious to know how to fix row context issue in this case. Thank you so much!

amitchandak
Super User
Super User

@JustinDoh1 , when you use rows context example min/max (min(A) = "A")  in a measure. the calculations are done at row level. And unless we use allselected and all, we are still on the same visual row.

 

In such a case, the grand total is recalculated. It misses the context as it does not have a name. That we why we take the help of summarize or values to group data from rows level to grand total level

 

As, summarize do not work same as the visual table always, we need to work on our formula

 

is this different from

https://community.powerbi.com/t5/DAX-Commands-and-Tips/Trying-to-understand-the-outcome-from-my-DAX-...

 

 

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

Thank you for your feedback.

I was using SWITCH, but my output is still very unstable. How do I go about wrapping up my calculate to be obvious and stable?
How do I go about "summarize or values to group data from rows level to grand total level"? 

Do I go that in the Calculate function at VAR section or inside Switch area?

Thanks.

 

I have updated file here.

JustinDoh1_0-1629410055298.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.