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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Islam
Helper V
Helper V

How can i get grand totals when using SWITCH

hello everyone

i have those two measures

1- Tangible Assets Revenue:=ROUND(

SWITCH(TRUE(),

MIN(PouringClientsLevel[Client]) = "The Office",[Pouring Per Client]*.10,

MIN(PouringClientsLevel[Client]) = "مول الذهب",[Pouring Per Client]*.10,

MIN(PouringClientsLevel[Client]) = "Audaz",[Pouring Per Client]*.20,

MIN(PouringClientsLevel[Client]) = "Catalan",[Pouring Per Client]*.20,

MIN(PouringClientsLevel[Client]) = "Gasco",[Pouring Per Client]*.20,

0

),

2

)

 

 

2- Cash Revenue:=[Pouring Per Client]-[Tangible Assets Revenue]

and they are working just fine at the filter context level but they give me either zero or wrong total at the grand totals level

 

so can i fix this to show the correct grand totals ?

I searched for a previous answer and tried some methods but nothing worked unfortunately

1.png

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

Did you try the measure I posted? It will return the correct totals by row and the grand total.  If you want to keep the measure name you can either use the code from your measures in the expression (instead of the measure itself) or just change the names of the nee measures. You can apply the same syntax for the other measure. 

If the measure I posted doesn't work, try this:

With Totals = 

SUMX(SUMMARIZE( Table, Table [ Row labels], "@total", [Tangible assets revenue]), [@total])





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

5 REPLIES 5
PaulDBrown
Community Champion
Community Champion

Try:

Assuming the table containing the field "Row labels" is 'Table',

 

totals = SUMX( Table, [tangible assets revenue])





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






thx sir for trying to help 

 but totals are working at the row level but what i need actually is to display the grand totals under the very same measures i mentioned above and highlighted in the image

 

PaulDBrown
Community Champion
Community Champion

Did you try the measure I posted? It will return the correct totals by row and the grand total.  If you want to keep the measure name you can either use the code from your measures in the expression (instead of the measure itself) or just change the names of the nee measures. You can apply the same syntax for the other measure. 

If the measure I posted doesn't work, try this:

With Totals = 

SUMX(SUMMARIZE( Table, Table [ Row labels], "@total", [Tangible assets revenue]), [@total])





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






the first measure didn't work but this did it Thx Sir

aha now i got it you mean i use my measure as intermediate measure to get the result i need

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.