Forum Discussion

sebasjun's avatar
sebasjun
Helper I
9 years ago
Solved

Accumulated values with two columns

Hello   Im need to create a accumlated column grouped by 2 criteria. In my case group by A_Codi and Month       Im create a measure with this formula    Acumulated = CALCULATE(sum(Query1[Total...
  • dearwatson's avatar
    9 years ago

    Hi Sebasjun,

     

    If you need the formula to maintain filters for other columns like 'A_Codi' you need to omit them from the ALL() call (as this will remove the filter context of the A-Codi column) Also I think the "<" should be a "<=" for it to work as you describe.

     

    Try this pattern:

     

    Acumulated = CALCULATE(sum(Query1[Total_USD]);FILTER(ALLEXCEPT(Query1, Query1[A_Codi]);Query1[Mes]<=max(Query1[Mes])))

     

    Cheers Greg