Luc
Luc

Reputation: 958

PowerBI cumulative line graph by year not working

Here is what I would like the output to be; a line graph showing cumulative counts according to year [ignore the dashed line, not relevant here]:

enter image description here

I created a cumulative measure like this:

Cumulative count = 
if(COUNTROWS(database)>0, 

CALCULATE (
    COUNTA ( database[case] ),
    FILTER (
        ALLSELECTED( database),
        database[Weeks2Create] <= MAX ( database[Weeks2Create] )
    )
)
)

Displaying single years work well (both ending around he 5k mark):

enter image description here

enter image description here

However, when I select multiple years... the counts seem to be adding up [see endpoint in graph below at ~10k, instead of 5k]:

enter image description here

What have I done wrong?

Upvotes: 0

Views: 423

Answers (1)

msta42a
msta42a

Reputation: 3741

Try to add to your calculation && database[Year] = SELECTEDVALUE(database[Year]) to specify that we want to calculate each line independently.

Upvotes: 1

Related Questions