Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Cumulative total by quarters

Hi,    I'm trying to compute a cumulative total by quarter.    My table has 4 columns : Entity (A, B, C, etc.) // Year (2017, 2018, 2019, etc.) // Quarter (Q1, Q2, Q3, Q4) // Values   I woud li...
  • Anonymous's avatar
    Anonymous
    7 years ago

    My apologies, missed that conditional statement:

     

    Measure:=
    VAR CurrentYear = 
    	MAX(<TableName>[Year])
    RETURN
    CALCULATE(
    	SUM(<TableName>[Values])
    	,FILTER(
    		ALL(<TableName>[Year]),
    		<TableName>[Year] <= CurrentYear
    	)
    )

     

     

    This first identifies the year in the current filter context, and then only includes years that are less than or equal to that value.