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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Samuele_M
Frequent Visitor

CUMULATIVE SUM by drilldown

hi, i have datas that look like the following example:

Samuele_M_0-1700496458912.png

i need to add another column to the graph with a cumulative sum of the "value" column but it has to restart from 0 on every subcategory (SCAT). i can't figure out how to do it, can someone help pls?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Samuele_M , Try to use window function

 

Cumm Based on subcategory= CALCULATE([Your measure], Window(1,ABS,0,REL, ALLSELECTED('Table'[Category],'Table'[subcategory]),ORDERBY('Table'[subcategory],asc),,partitionBy('Table'[Category])))

 

Continue to explore Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
https://medium.com/@amitchandak/power-bi-window-function-3d98a5b0e07f

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Samuele_M , Try to use window function

 

Cumm Based on subcategory= CALCULATE([Your measure], Window(1,ABS,0,REL, ALLSELECTED('Table'[Category],'Table'[subcategory]),ORDERBY('Table'[subcategory],asc),,partitionBy('Table'[Category])))

 

Continue to explore Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc
https://medium.com/@amitchandak/power-bi-window-function-3d98a5b0e07f

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Ty!! this works but i have so many subcategories that it takes few minutes to load; is there any way to optimize the measure? will it be faster if i make it in powerquery following this guide? https://gorilla.bi/power-query/running-total-by-category/

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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