Forum Discussion
sparker22
3 years agoFrequent Visitor
Cumulative count based on relative date filter
I have a graph that using a relative date filter looks at the last 12 months. Is it possible to create a cumulative count that uses the same relative date filter, rather than including previous mont...
tamerj1
Community Champion
3 years agoHi sparker22
Please try
Cumulative Measure 2 =
IF (
NOT ISEMPTY ( FactTable ),
[Cumulative Measure]
)sparker22
3 years agoFrequent Visitor
Hi tamerj1
This succeeds in removing the line on the graph on irrelevant months, but still totals the previous irrelevant months figures in the first relevant month
- tamerj13 years ago
Community Champion
Hi sparker22
In this case you need to edit the original measure code. Can you paste the code in a reply?
- sparker223 years agoFrequent Visitor
This is the original code. The relative date filter is added on the visual level, rather than code.
Cumulative Total =CALCULATE (COUNT('Outcome'[OutcomeID]),FILTER (ALL( 'Calendar'[Date] ),'Calendar'[Date] <= MAX ( 'Calendar'[Date] )))- tamerj13 years ago
Community Champion
Please try
Cumulative Total =
VAR CurrentDate =
MAX ( 'Calendar'[Date] )
VAR FirstDateWithData =
CALCULATE ( MIN ( 'Outcome'[Date] ), REMOVEFILTERS () )
RETURN
CALCULATE (
COUNT ( 'Outcome'[OutcomeID] ),
'Calendar'[Date] >= FirstDateWithData,
'Calendar'[Date] <= CurrentDate
)