Blanks in DAX cumulative sum

Bloch1811

New Member
Joined
Oct 9, 2017
Messages
2
Hi

I’m trying to make an cumulative sum of production quantities throughout the year.

I have created a DAX measure in PowerPivot that works fine on the totals as illustrated in the below table, however, on the detailed level I get blanks which causes issues when I want to compare the YTD figure for May with the YTD figure for October on a detailed level.

My DAX formula looks like this:
Actual Production:=IF(MIN('SCP calendar'[SCP Date])<=CALCULATE(MAX(Actual_Production[Date]);ALL(Actual_Production)); CALCULATE(SUM(Actual_Production[Qty in BC or Pack]);FILTER(ALL('SCP calendar'[SCP Date]);'SCP calendar'[SCP Date]<=MAX(Actual_Production[Date]))))

[Actual Production] is a transaction table of with production data
[SCP calendar] is the calendar table.

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Jan[/TD]
[TD]Feb[/TD]
[TD]Mar[/TD]
[TD]Apr[/TD]
[TD]May[/TD]
[TD]Jun[/TD]
[TD]Jul[/TD]
[TD]Aug[/TD]
[TD]Sep[/TD]
[TD]Grand total[/TD]
[/TR]
[TR]
[TD]Product group 1[/TD]
[TD]5[/TD]
[TD]15[/TD]
[TD]28[/TD]
[TD]32[/TD]
[TD]40[/TD]
[TD]50[/TD]
[TD]62[/TD]
[TD]68[/TD]
[TD]71[/TD]
[TD]71[/TD]
[/TR]
[TR]
[TD]Product A[/TD]
[TD][/TD]
[TD]4[/TD]
[TD][/TD]
[TD][/TD]
[TD]6[/TD]
[TD]10[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]Product B[/TD]
[TD][/TD]
[TD]5[/TD]
[TD]12[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]20[/TD]
[TD][/TD]
[TD][/TD]
[TD]20[/TD]
[/TR]
[TR]
[TD]Product C[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]12[/TD]
[TD]16[/TD]
[TD]22[/TD]
[TD]28[/TD]
[TD]32[/TD]
[TD]38[/TD]
[TD]41[/TD]
[TD]71[/TD]
[/TR]
[TR]
[TD]Grand Total[/TD]
[TD]5[/TD]
[TD]15[/TD]
[TD]28[/TD]
[TD]32[/TD]
[TD]40[/TD]
[TD]50[/TD]
[TD]62[/TD]
[TD]68[/TD]
[TD]71[/TD]
[TD]71[/TD]
[/TR]
</tbody>[/TABLE]



Anyone who have an idea on how I get the previous months figure repeated in the blank cells?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi gazpage

Thank you for taking your time to answer. The TOTALYTD function gave the same issues as the formula I had.

However, I found a solution using the formula below:

Actual prod - cumulative :=
CALCULATE (
SUM ( Actual_Production[Qty in BC or Pack] );
FILTER (
ALLSELECTED ( Actual_Production );
AND (
Actual_Production[Date] <= MAX ( 'SCP calendar'[SCP Date] );
YEAR ( Actual_Production[Date] ) = YEAR ( MAX ( 'calendar'[Date] ) )
)
);
VALUES ( MasterData )
)

The key was to add the VALUES-section with the table I use to split up the total.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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