Running total is the same as daily total?

MelH

New Member
Joined
Jan 31, 2021
Messages
5
Office Version
  1. 2010
Platform
  1. Windows
Not sure what I am doing wrong. My running variance is the same as the daily variance. Can someone help? Thanks

Hours 2 = max(Test[Hours 1])
Variance = DIVIDE(sum(Test[Amt]),[Hours 2],0)
VarianceRT = CALCULATE([Variance], FILTER(ALL(Test[Date]),Test[Date]<=MAX(Test[Date])))

1612070062512.png


1612070122945.png
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
For a running total your filter should return all dates smaller then or equal to current date. The way you have defined it, it only returns the same data. Hence the same result as for variance.
Define Max(Test[Date]) as a variable first, then return the result via your formula using the variable.
Notice, for time intelligence (YTD, MTD) it is a best practice to use a calendar table.
Maybe this tutorial sheds some light Cumulative total – DAX Patterns
 
Upvote 0
For a running total your filter should return all dates smaller then or equal to current date. The way you have defined it, it only returns the same data. Hence the same result as for variance.
Define Max(Test[Date]) as a variable first, then return the result via your formula using the variable.
Notice, for time intelligence (YTD, MTD) it is a best practice to use a calendar table.
Maybe this tutorial sheds some light Cumulative total – DAX Patterns
Thanks, I made some changes and it worked.
 
Upvote 0
Glad to hear you got the solution.

Do you mind posting about what changes you applied to get it to work? Then it is perfectly fine to mark your post as the solution to help future readers.
 
Upvote 0
This is what worked.

I created a calendar table (linked it the the Test table) and used the date from that.

I still don't totally understand how it works but will keep having a play with it.

Power Query:
VarianceRT =
VAR DateMax = MAX('Date'[Date])
Return
CALCULATE([Variance], FILTER(ALL(Test[Date]),Test[Date]<=DateMax))
 
Last edited by a moderator:
Upvote 0
How would i change this formula to have a daily running total but reset each month? Or should I start a new post. Thanks
 
Upvote 0
I worked it out. The real data I am working with using a custom calendar.

Power Query:
VarianceRTMth =
VAR DateMax = MAX('Date'[Date])
VAR DateMaxMth = MAX('Date'[Month])
Return
CALCULATE([Variance], FILTER(ALL(Test[Date]),Test[MonthMeasure]=DateMaxMth&&Test[Date]<=DateMax))
 
Upvote 0

Forum statistics

Threads
1,223,739
Messages
6,174,217
Members
452,551
Latest member
croud

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top