powerbidax

Measure shows wrong SubTotal in Matrix Visual


In a Matrix visual I need to display the amount of entries by year, nationality and day. If I use the Value in my Matrix I get a correkt SubTotal as shown in green.
But since I will need to do some gowth calculations later on, I need to use a measure for that:

Measure = 
    CALCULATE( SUM(EntryTime_ALL[Value])
        ,EntryTime_ALL[Herkunft] = MAX(EntryTime_ALL[Herkunft])
        ,EntryTime_ALL[Tag] = MAX(EntryTime_ALL[Tag])
        ,EntryTime_ALL[Jahr] = MAX(EntryTime_ALL[Jahr])
    )

But by using a measure the SubTotal by "Tag" does not work properly and just takes the last value of the Rows. As shown in red.

enter image description here

Can someone please show me how to fix this?


Solution

  • When it is doing the Total, it has no row context so using MAX will take the last/max value. Instead use IN similar to:

    Measure = 
      CALCULATE(
        SUM(EntryTime_ALL[Value])
        ,EntryTime_ALL[Herkunft] IN DISTINCT(EntryTime_ALL[Herkunft])
        ,EntryTime_ALL[Tag] IN DISTINCT(EntryTime_ALL[Tag])
        ,EntryTime_ALL[Jahr] IN DISTINCT(EntryTime_ALL[Jahr])
      )