DAX Problem with Running Total

losamfr17

Board Regular
Joined
Jun 10, 2016
Messages
149
Hello dear wizards,

I need a measure to calculate running total for the week, month and season. My sample table and preferred output are visible below.
I searched the web and tried "=CALCULATE(SUM([Sales]), FILTER( ALL(Source[WeekNumber]), [Week Number] <= MAX(Source[Week Number]) ) )", but the running total did not work for the month and season subtotals.

Could you please advise?

FYI: in my data model, I do not have a date column.

ChainNameWeekNumberMonthNameSeasonNameSales
Belk
12​
AprilSPRING
9.5​
Sephora
11​
AprilSPRING
4.9​
Sephora
15​
MaySPRING
3.7​
Ulta
10​
AprilSPRING
357​
Ulta
12​
AprilSPRING
310​
Ulta
8​
MarchSPRING
340​
Ulta
13​
AprilSPRING
319​
Ulta
48​
DecemberFALL
434​
Ulta
48​
DecemberFALL
336​
Ulta
9​
MarchSPRING
331​
Nordstrom
4​
FebruarySPRING
0.1​
Sephora
16​
MaySPRING
4.3​
Nordstrom
7​
MarchSPRING
0​
Sephora
10​
AprilSPRING
3.6​

1591738535127.png
 

Attachments

  • 1591738006569.png
    1591738006569.png
    20.8 KB · Views: 10
  • 1591738183807.png
    1591738183807.png
    9.3 KB · Views: 10

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Consider restructuring your data - strictly the MonthName column adds no more detail than the week number. I'd prefer to have actual dates against each Chain Name. Then create a Calendar Table in PowerPivot (it can do it for you, though you'd need to add the Season as another column). Then link the Dates column in Calendar and your data table. You would probably use the Time Intelligence functions to provide your running totals.

Another way of doing so is to have the calendar as a disconnected table, define measures of [StDate]=min(Calendar[Date]) and [EndDate]=max(Calendar[Date]) and then use those two measures as filter parameters in measures to arrive at your running totals.

Hope that points in the right direction.
 
Upvote 0
In an ordinary Pivot Table:
View attachment 15846

Make sure the numbers are numbers?

Numbers are set as numbers. MonthName as text. In your screenshot you can see that the running total does not follow through the Month subtotals and the season subtotals. For example, May is less than April and Fall is less than Spring. In a running total each week would be greater than the earlier week.
 
Upvote 0
Consider restructuring your data - strictly the MonthName column adds no more detail than the week number. I'd prefer to have actual dates against each Chain Name. Then create a Calendar Table in PowerPivot (it can do it for you, though you'd need to add the Season as another column). Then link the Dates column in Calendar and your data table. You would probably use the Time Intelligence functions to provide your running totals.

Another way of doing so is to have the calendar as a disconnected table, define measures of [StDate]=min(Calendar[Date]) and [EndDate]=max(Calendar[Date]) and then use those two measures as filter parameters in measures to arrive at your running totals.

Hope that points in the right direction.

Thank you for that. I might try that since nothing has worked so far.
 
Upvote 0
one thing to remember is that Excel (like all computers is pretty daft), it doesnt understand what 'April' means either in the context of week numbers or that it comes before 'May'.

I think you should get some useful results by restructuring - good luck.
 
Upvote 0

Forum statistics

Threads
1,223,790
Messages
6,174,600
Members
452,574
Latest member
hang_and_bang

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