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
halskwibskc
Frequent Visitor

Using SWITCH (TRUE(),) but Grand Total calculation is missing

Hi all, 

 

I need the Grand Total value but it is misisng. 

 

revenuediff = 
var currentweeknum = SELECTEDVALUE(table[weeknum cloumn])
var website = [revenue] - CALCULATE([revenue],FILTER(ALLEXCEPT(table,table[web_site]),table[weeknum cloumn]= currentweeknum -1))
var product = [revenue] - CALCULATE([revenue],FILTER(ALLEXCEPT(table,table[product]),table[weeknum cloumn]= currentweeknum -1))
var size = [revenue] - CALCULATE([revenue],FILTER(ALLEXCEPT(table,table[size]),table[weeknum cloumn] = currentweeknum -1))
var device = [revenue] - CALCULATE([revenue],FILTER(ALLEXCEPT(table,table[device_]),table[weeknum cloumn] = currentweeknum -1))
return
SWITCH(true(),ISINSCOPE(table[web_site]),website,ISINSCOPE(table[product]),product,ISINSCOPE(table[size]),size,ISINSCOPE(table[device_]),device)

 

[revenue] is a measure btw.

halskwibskc_0-1666880886748.png

 

Is there a way to show the grand total correctly? 

1 REPLY 1
lbendlin
Super User
Super User

Grand Total and SELECTEDVALUE are incompatible. Change your formula to avoid the use of SELECTEDVALUE.  Use VALUES  instead, for example. 

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.