1
votes

How can I write a DAX cumulative measure that - not only - works over time - but also allows me to draw a line for different categories?

As soon as I drag a category into the 'Legend' of the line chart it does not work - all lines represent the cumulative of all categories.

enter image description here

this is what i expect based on my data ...:

enter image description here

Here is my DAX: The resulting 'total' cumulative is correct - but it does not break it down by legend / category?

CALCULATE(
    SUM( [VALUE] ),
    FILTER(
        ALLSELECTED( Fact ),
        Fact[Date] <= MAX( Fact[Date] )
    )
)
1
I recommend Daxformatter, easier to read.Przemyslaw Remin

1 Answers

1
votes

Simply add a Category to the filter:

CALCULATE(
    SUM( Fact[Value] ),
    FILTER(
        ALLSELECTED( Fact ),
        Fact[Date] <= MAX( Fact[Date] )
            && Fact[Category] = MAX( Fact[Category] ) // <- This line
    )
)