Forum Discussion
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_USD]);FILTER(ALL(Query1);Query1[Mes]<max(Query1[Mes])))
But not run!!
I need Accomulated has this values
A_Codi Month Acumulated Total_USD
28812 February -40.60 -40.60
28812 March -40.60 0
36100 April -35.44 -35.44
..
36246 January 0 0
36246 February 0 0
36246 March -2396.00 -2396.00
36246 April 2248,63 4644,63
36246 May 3075.31 826.68
36246 June 3379.3 303.99
Thanks
Best regards
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
4 Replies
- dearwatson
Continued Contributor
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
- sebasjun
Helper I
Hello
Thanks for the reply
The formula runs correctly with my samples, but i try to put the table to a line graph and apply a filter by a_codi and the filter not run, but i change to table and the table filter correctly.
I think initially the problem is the Alllexcept, but why the table runs and the line chart not???
Best regards
- AnonymousNot applicable
Hi sebasjun,
Can you provide the sample file to test? It is hard to reproduce and fix your issue from your description
Regards,
Xiaoxin Sheng