DAX running total that does not recalculate at the end of a period or group.

dicken

Active Member
Joined
Feb 12, 2022
Messages
292
Office Version
  1. 365
Platform
  1. Windows
HI,
I have a simple running total measure ;

Excel Formula:
RTM:=VAR mdate = MAX(Table2[Date]) 
VAR anser = 
CALCULATE([tSales],FILTER(ALL(Table2[Date]),Table2[Date]<= mdate ) )
RETURN anser

but when I put this into a pivot table where the dates are groped by Month the accumulative pricess restarts at the end of each monht,
if it's not grouped it just carries on, is there a way to cause it to ignore the grouping. So for screen short below the first figure for March would be 64.
Richard.


1657111601339.png
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
HI,
I have a simple running total measure ;

Excel Formula:
RTM:=VAR mdate = MAX(Table2[Date])
VAR anser =
CALCULATE([tSales],FILTER(ALL(Table2[Date]),Table2[Date]<= mdate ) )
RETURN anser

but when I put this into a pivot table where the dates are groped by Month the accumulative pricess restarts at the end of each monht,
if it's not grouped it just carries on, is there a way to cause it to ignore the grouping. So for screen short below the first figure for March would be 64.
Richard.


View attachment 68723
This is cross questioned on Excel Forum ;
 
Upvote 0
The grouping creates a new field which has its own filter context and your ALL doesn't cater for it, so you'd need something like:

Excel Formula:
=VAR sdate = MAX(ForumTotals[Date])
RETURN 
CALCULATE([tsale],FILTER(ALL(ForumTotals[Date],ForumTotals[Date (Month)]),ForumTotals[Date]<= sdate) )
 
Upvote 0
The grouping creates a new field which has its own filter context and your ALL doesn't cater for it, so you'd need something like:

Excel Formula:
=VAR sdate = MAX(ForumTotals[Date])
RETURN
CALCULATE([tsale],FILTER(ALL(ForumTotals[Date],ForumTotals[Date (Month)]),ForumTotals[Date]<= sdate) )
I've had a couple of responses but not had time to try any out, but will get back to you once I have.

RD
 
Upvote 0
The grouping creates a new field which has its own filter context and your ALL doesn't cater for it, so you'd need something like:

Excel Formula:
=VAR sdate = MAX(ForumTotals[Date])
RETURN
CALCULATE([tsale],FILTER(ALL(ForumTotals[Date],ForumTotals[Date (Month)]),ForumTotals[Date]<= sdate) )
Thanks, that works fine, I like it very much as it might , as thinking of 'date and 'month ' separately had not occurred to me.

I've also found that if you 'create' a Calendar table and use the dates from that it does not re- calculate,
conversely if you use the dates from the 'sales' in the pivot but the Calendar dates in the measure it does.
I've had a response on Excel forum and uploaded sheet with two pivots one using dates from Calendar and the other dates form 'sales' table and how they both behave. Your measure is 'using Sales Filer Date and Month' .

HTML:
https://www.excelforum.com/office-365/1382041-dax-running-total-that-does-not-recalculate-at-each-group.html



1657596832388.png


Richard
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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