Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
sebasjun
Helper I
Helper I

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])))

 

2017-06-16_20h37_25.png

 

 

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

 

 

 

1 ACCEPTED SOLUTION
dearwatson
Continued Contributor
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

 

 

View solution in original post

4 REPLIES 4
dearwatson
Continued Contributor
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

 

 

 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

 

 

Anonymous
Not 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

If use a table the solution is correct and this is my inital problem.

 

Thanks a lot

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.