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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Frequent Visitor

Cumulative column Dax

Hello, I want to create a cumulative column. I tried several formulas but I'm stuck for a while.Thank you in advance for your help !

[For information, this is a table of more than 1 million rows
Category = Computed column
Amount no cumulated = Computed column
Step = Computed column (this is a V search which contains steps A,B,C,D but also empty)]

The values for the opening do not change and it must be accumulated in this order:

Opening, V_Calculation,V_Asset,V_Category,B_Calculation

V_Calculation = Opening + V_Calculation
V_Asset =Opening + V_Calculation+V_Asset

V_Category = Opening + V_Calculation+V_Asset+V_Category 
B_Calculation = Opening +B_Calculation

Here's a little preview : 

Category       Step.   Amount no cumulated                  Desired result                    
Opening D3434
Opening A1313
Opening B7070




Community Support
Community Support

Hi @Power_BI_new 


If I understand it correctly, you can first add a calculated column with below DAX

Index = SWITCH([Category],

Then create the second calculated column

Result = SWITCH([Index],
1,[Amount no cumulated],
2,SUMX(FILTER('Table','Table'[Step.]=EARLIER('Table'[Step.])&&'Table'[Index]<=2&&'Table'[Index]>=1),'Table'[Amount no cumulated]),
SUMX(FILTER('Table','Table'[Step.]=EARLIER('Table'[Step.])&&'Table'[Index]<=EARLIER('Table'[Index])&&'Table'[Index]>=1&&'Table'[Index]<>2),'Table'[Amount no cumulated])


This could give you the desired result. This calculation may take some time to complete as this table has more than 1 million rows. 


Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Hello thank you very much for your answer, but I don't get the desired result and I don't understand why.

For the Opening category, the numbers don't move, which is ok. But if we go to the next step: V_Calculation , for example for step B, it gives me the sum of when I filter in my table on these elements, it does not give me the sum of the opening + the digits of V_Calculation

Super User
Super User

This doesn't look like a cumulative function.  Each of the step values are handled independently?

It's in this order : 

V_Calculation = Opening + V_Calculation
V_Asset =Opening + V_Calculation+V_Asset

V_Category = Opening + V_Calculation+V_Asset+V_Category 
B_Calculation = Opening +B_Calculation

it's just for B_calculation that it's different

Still not clear to me. Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Please show the expected outcome based on the sample data you provided.

Helpful resources

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.