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

Table Total

I am working with the below formula, but need to show the sum of these on the matrix that is pulling these in. 
 
BBT Daily Supervisor Goal =
 
VAR _Super = SELECTEDVALUE(User_Information[Supervisor])
VAR _OpsMan = SELECTEDVALUE(User_Information[Operations Manager])

 

    Return
 
SWITCH(
        True(),
  _Super = "Name 1", 2927,
    _Super = "Name 2", 1919,
    _Super = "Name 3", 991,
    _Super = "Name 4", 3770,
    _Super = "Name 5", 3304,
    _Super = "Name 6", 2822,
    _Super = "Name 7", 0,
    _OpsMan = "Name 8", 5837,
    _OpsMan = "Name 9", 12396)
 
arobinson_0-1660234616701.png

 

1 REPLY 1
ValtteriN
Super User
Super User

Hi,

Table totals are always a bit tricky subject. In short I recommend using SUMX in your dax to solve this behaviour. Basically since the SELECTEDVALUE variables return blank for the total row your formula returns blank.

Example:

ValtteriN_0-1660249222294.png

Measure 22 (a measure without any tricks):

var letter = SELECTEDVALUE('Table (11)'[Column1]) return
SWITCH(TRUE(),
letter="A",1,
letter="B",1,
letter="C",1)

Measure 23 (total logic correction):

IF(SELECTEDVALUE('Table (11)'[Column1])=BLANK(),
SUMX(ALL('Table (11)'),[Measure 22]),[Measure 22])
End result:
ValtteriN_1-1660249647576.png

 







Here is an excellent explanation byt SQLBI on what is going on here: https://www.sqlbi.com/articles/obtaining-accurate-totals-in-dax/


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.

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.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Top Solution Authors