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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Responsive Resident
Responsive Resident

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

 

 

"The commonality between science and art is in trying to see profoundly - to develop strategies of seeing and showing." - Edward Tufte

View solution in original post

4 REPLIES 4
dearwatson
Responsive Resident
Responsive Resident

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

 

 

"The commonality between science and art is in trying to see profoundly - to develop strategies of seeing and showing." - Edward Tufte

 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

 

 

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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

 

Thanks a lot

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.