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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Running Total Not Working

Hi Folks, 

 

I'm trying to get the running total for my tables with date and group filters.

 

Following is the DAX syntax I'm using but it is not giving the correct anwer,

For Column,

 

Running_TotalC =
CALCULATE(
SUM(Data_2[P1Log_Ret]),
FILTER(
ALLEXCEPT(Data_2, Data_2[Group] ,Data_2[ReturnDate]),
Data_2[ReturnDate] <= EARLIER(Data_2[ReturnDate])
)
)
 
And For measure,
 
Running_Total =
CALCULATE(
SUM(Data_2[P1Log_Ret]),
FILTER(
ALLEXCEPT(Data_2, Data_2[PMSAcronym] ,Data_2[ReturnDate]),
Data_2[ReturnDate] <= SELECTEDVALUE(Data_2[ReturnDate])
)
)
 

Could you please help me in this. 

 

 

ReturnDateGroupFundReturnP1Log_RetRunning_TotalC
1/31/2013 0:00A-0.00195227-0.001954178-0.001954178
2/1/2013 0:00A0.0002673380.0002673020.000267302
2/2/2013 0:00A0.0001860130.0001859960.000185996
2/3/2013 0:00A0.0001866610.0001866440.000186644
2/4/2013 0:00A-0.001295777-0.001296618-0.001296618
2/5/2013 0:00A-0.000439921-0.000440018-0.000440018
2/6/2013 0:00A0.000161580.0001615660.000161566
2/7/2013 0:00A-0.000492769-0.00049289-0.00049289
2/8/2013 0:00A0.0005908210.0005906460.000590646
2/9/2013 0:00A0.0001882430.0001882250.000188225
2/10/2013 0:00A0.0001882080.0001881910.000188191
2/11/2013 0:00A-0.000108518-0.000108524-0.000108524
2/12/2013 0:00A3.2959E-063.29589E-063.29589E-06
2/1/2013 0:00B-0.001927674-0.001929534-0.001929534
2/2/2013 0:00B0.0001794520.0001794360.000179436
2/3/2013 0:00B0.0001804870.0001804710.000180471
2/4/2013 0:00B0.0018849930.0018832190.001883219
2/5/2013 0:00B-0.002777571-0.002781436-0.002781436
2/6/2013 0:00B0.0031227460.003117880.00311788
2/7/2013 0:00B0.0004238510.0004237610.000423761
2/8/2013 0:00B-0.000412682-0.000412767-0.000412767
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

If i understand you correctly, please modify "ALLEXCEPT(Data_2, Data_2[Group] ,Data_2[ReturnDate])" to "ALLEXCEPT(Data_2, Data_2[Group])".

For Column:

Running_Total_C = 
CALCULATE (
    SUM ( Data_2[P1Log_Ret] ),
    FILTER (
        ALLEXCEPT ( Data_2, Data_2[Group] ),
        Data_2[ReturnDate] <= EARLIER ( Data_2[ReturnDate] )
    )
)

For Measure:

Running_Total_M = 
CALCULATE (
    SUM ( Data_2[P1Log_Ret] ),
    FILTER (
        ALLEXCEPT ( Data_2, Data_2[Group] ),
        Data_2[ReturnDate] <= SELECTEDVALUE ( Data_2[ReturnDate] )
    )
)

Result would be shown as below:

1.PNG2.PNG

BTW, if you want to calculate Running Total per month, please refer to the formula below.

Running_Total_monthly = 
CALCULATE (
    SUM ( Data_2[P1Log_Ret] ),
    FILTER (
        ALLEXCEPT ( Data_2, Data_2[Group] ),
        Data_2[ReturnDate] <= EARLIER ( Data_2[ReturnDate] )
            && FORMAT ( Data_2[ReturnDate], "YYYYMM" )
                = FORMAT ( EARLIER ( Data_2[ReturnDate] ), "YYYYMM" )
    )
)

3.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

If i understand you correctly, please modify "ALLEXCEPT(Data_2, Data_2[Group] ,Data_2[ReturnDate])" to "ALLEXCEPT(Data_2, Data_2[Group])".

For Column:

Running_Total_C = 
CALCULATE (
    SUM ( Data_2[P1Log_Ret] ),
    FILTER (
        ALLEXCEPT ( Data_2, Data_2[Group] ),
        Data_2[ReturnDate] <= EARLIER ( Data_2[ReturnDate] )
    )
)

For Measure:

Running_Total_M = 
CALCULATE (
    SUM ( Data_2[P1Log_Ret] ),
    FILTER (
        ALLEXCEPT ( Data_2, Data_2[Group] ),
        Data_2[ReturnDate] <= SELECTEDVALUE ( Data_2[ReturnDate] )
    )
)

Result would be shown as below:

1.PNG2.PNG

BTW, if you want to calculate Running Total per month, please refer to the formula below.

Running_Total_monthly = 
CALCULATE (
    SUM ( Data_2[P1Log_Ret] ),
    FILTER (
        ALLEXCEPT ( Data_2, Data_2[Group] ),
        Data_2[ReturnDate] <= EARLIER ( Data_2[ReturnDate] )
            && FORMAT ( Data_2[ReturnDate], "YYYYMM" )
                = FORMAT ( EARLIER ( Data_2[ReturnDate] ), "YYYYMM" )
    )
)

3.PNG

 

Best Regards,

Jay

Community Support Team _ Jay Wang

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

mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous ,

 

did you solve your problem?


If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


mwegener
Most Valuable Professional
Most Valuable Professional

Hi @Anonymous 

 

You may download my PBIX file from here.
Hope this helps.

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast - Power BI Tutorials


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.