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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Neel98
Frequent Visitor

Cumulative Sum for individual material

I want to find out the Cumulative sum for individual materials. I have highlighted the desired result in yellow. Is this possible in DAX?

Neel98_0-1687954079136.png

 

1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Neel98 ,

 

You can achieve this in Power BI. You need to add an [Index] or [Date] column to determine the order of the data.

Here I suggest you to add an Index by material group in Power Query Editor.

Sort your table as you want> Group all rows by Material column > Add index column by M query.

Table.AddIndexColumn([Count],"Index",1)

For reference:

Create Row Number for Each Group in Power BI using Power Query

vrzhoumsft_0-1688111021476.png

Calculated column:

Cummulative Sum =
CALCULATE (
    SUM ( 'Table'[Qty] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[Material] ),
        'Table'[Index] <= EARLIER ( 'Table'[Index] )
    )
)

Result is as below.

vrzhoumsft_1-1688111108633.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @Neel98 ,

 

You can achieve this in Power BI. You need to add an [Index] or [Date] column to determine the order of the data.

Here I suggest you to add an Index by material group in Power Query Editor.

Sort your table as you want> Group all rows by Material column > Add index column by M query.

Table.AddIndexColumn([Count],"Index",1)

For reference:

Create Row Number for Each Group in Power BI using Power Query

vrzhoumsft_0-1688111021476.png

Calculated column:

Cummulative Sum =
CALCULATE (
    SUM ( 'Table'[Qty] ),
    FILTER (
        ALLEXCEPT ( 'Table', 'Table'[Material] ),
        'Table'[Index] <= EARLIER ( 'Table'[Index] )
    )
)

Result is as below.

vrzhoumsft_1-1688111108633.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

some_bih
Super User
Super User

Hi @Neel98 just create measure like Total quantity = SUM(<YOUR TABLE NAME>[Qty]) and put it on table / matrix. 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.