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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
moe10134
New Member

Running total for each date with a number

I need some assistance to help me troubleshoot getting a running total for each date with a number. All the videos I've watched are CALCULATE [Total Sales] by creating a Total Sales measure. I am not using sales data. I am looking to add each number for each date in date order. I've tried CALCULATE with MAX [date] DAX codes, using VAR, I even tried Quick Measures and I just got the sum of all numbers repeated for each date.  Do I need to create a measure to get the total of each number in the table column that contains 1 number per date? How can I just add JAN 1, 2022 = 10,  + JAN 2, 2022 =5 then (10+5) = 15 + JAN 3, 2022 = 3 then (15+3) = 18 to create an increasing final number to DEC 31, 2024?  Eventually, this will go into a line chart so it will be one ascending line from bottom to top. 

I'm so confused! Can someone please thoroughly explain what I need to do or what I am doing wrong? Much appreciated!

1 ACCEPTED SOLUTION
gmsamborn
Super User
Super User

Hi @moe10134 

 

Are you using a date table?  If so...

Running Total - w/DateTable = 
VAR _Curr = SELECTEDVALUE( 'Date'[Date] )
VAR _Start = DATE( 2022 , 1, 1)
VAR _End = MIN( DATE( 2024, 12, 31), _Curr )
VAR _RT =
    CALCULATE(
        SUM( 'DataTable'[Amount] ),
        ALL( 'Date'[Date] ),
        'Date'[Date] >= _Start,
        'Date'[Date] <= _End
    )
RETURN
    _RT

 

If not...

Running Total - No DateTable = 
VAR _Curr = SELECTEDVALUE( 'DataTable'[Date] )
VAR _Start = DATE( 2022 , 1, 1)
VAR _End = MIN( DATE( 2024, 12, 31), _Curr )
VAR _RT =
    CALCULATE(
        SUM( 'DataTable'[Amount] ),
        ALL( 'DataTable'[Date] ),
        'DataTable'[Date] >= _Start,
        'DataTable'[Date] <= _End
    )
RETURN
    _RT

 

Let me know if you have any questions.

 

Running total for each date with a number.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

View solution in original post

3 REPLIES 3
gmsamborn
Super User
Super User

Hi @moe10134 

 

Are you using a date table?  If so...

Running Total - w/DateTable = 
VAR _Curr = SELECTEDVALUE( 'Date'[Date] )
VAR _Start = DATE( 2022 , 1, 1)
VAR _End = MIN( DATE( 2024, 12, 31), _Curr )
VAR _RT =
    CALCULATE(
        SUM( 'DataTable'[Amount] ),
        ALL( 'Date'[Date] ),
        'Date'[Date] >= _Start,
        'Date'[Date] <= _End
    )
RETURN
    _RT

 

If not...

Running Total - No DateTable = 
VAR _Curr = SELECTEDVALUE( 'DataTable'[Date] )
VAR _Start = DATE( 2022 , 1, 1)
VAR _End = MIN( DATE( 2024, 12, 31), _Curr )
VAR _RT =
    CALCULATE(
        SUM( 'DataTable'[Amount] ),
        ALL( 'DataTable'[Date] ),
        'DataTable'[Date] >= _Start,
        'DataTable'[Date] <= _End
    )
RETURN
    _RT

 

Let me know if you have any questions.

 

Running total for each date with a number.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

Thank you so much for the DAX code and for providing me with a Power BI file to see how all this code applies from a table perspective. It completed my visual perfectly. I've been spinning my brain over this for 2 weeks, all your help is greatly appreciated. Thank you very much! 😀

You're welcome.



Proud to be a Super User!

daxformatter.com makes life EASIER!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.