Forum Discussion

arobinson's avatar
arobinson
Frequent Visitor
4 years ago

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)
 

 

1 Reply

  • ValtteriN's avatar
    ValtteriN
    Community Champion

    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:

    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:

     







    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/