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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Ajaal
Helper I
Helper I

add running Total/cumulative sum Column to powerbi dataset

Hi There...

 

 I need to add running Total or cumulative sum Column to Sales column in my powerbi dataset which looks like

 

ProductDateSales
A01/01/20221130
B02/01/20222000
C03/01/20222100
A01/02/20221500
B02/02/20221915
C03/02/20222599
A01/03/20221750
B02/03/20222800
C03/03/20223099
A01/04/20222200
B02/04/20222900
C03/04/20223300

 

and It should look like ...

 

ProductDateSalesCum_Sale
A01/01/202211301130
B02/01/202220002000
C03/01/202221002100
A01/02/202215002630
B02/02/202219153915
C03/02/202225994699
A01/03/202217504380
B02/03/202228006715
C03/03/202230997798
A01/04/202222006580
B02/04/202229009615
C03/04/2022330011098

 

how DAX function should be added to get the above column "Cum_Sales"..?

 

Thnx Much...

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @Ajaal 

 

Please try this:

Cum_Sales =
CALCULATE (
    SUM ( 'Table'[Sales] ),
    FILTER (
        FILTER ( 'Table', 'Table'[Product] = EARLIER ( 'Table'[Product] ) ),
        'Table'[Date] <= EARLIER ( 'Table'[Date] )
    )
)

danextian_0-1689206793288.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

If you want a measure solution, then try this

  1. Create a Calendar Table
  2. Create a relationship (Many to One and Single) from the Date column of the Data Table to the Date column of the Calendar Table
  3. To your visual, drag Product and Date (from the Calendar Table)
  4. Write these measures

Total = sum(Data[Sales])

Running total = if([total]=blank(),blank(),calculate([Total],datesbetween(calendar[date],minx(all(calendar[date]),calendar[date]),max(calendar[date]))))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
danextian
Super User
Super User

Hi @Ajaal 

 

Please try this:

Cum_Sales =
CALCULATE (
    SUM ( 'Table'[Sales] ),
    FILTER (
        FILTER ( 'Table', 'Table'[Product] = EARLIER ( 'Table'[Product] ) ),
        'Table'[Date] <= EARLIER ( 'Table'[Date] )
    )
)

danextian_0-1689206793288.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors