PowerPivot need repeat values by date

macfuller

Active Member
Joined
Apr 30, 2014
Messages
319
Office Version
  1. 365
Platform
  1. Windows
I am trying to duplicate values for dates when all I have is the start date. It's a SUM of all relevant volume but not cumulative since I don't want to add from the prior month.

I receive a row value showing weekly quantity processed by start date. I also have a standard date table with every date in the range.

Customer Volume Start Date
A 20,000 5/1/2017
B 10,000 5/1/2017
A 5,000 8/1/2017
C 10,000 10/1/2017

I would like the result to be a pivot table showing the total volume for each month

2017
2018
Jan
45,000
Feb
45,000
Mar
45,000
Apr
45,000
May
30,000
45,000
Jun
30,000
etc
Jul
30,000
Aug
35,000
Sep
35,000
Oct
45,000
Nov
45,000
Dec
45,000

<tbody>
</tbody>

How can I write a DAX measure to provide the numbers? I would also like to have other derived measures (e.g. cost per unit) based on the volume totals.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Just to verify, the standard Cumulative pattern adds the prior month instead of duplicating it. So

Code:
Cumulative Production:=
[SIZE=1][COLOR=#008000][SIZE=1][COLOR=#008000]CALCULATE[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=1] ([/SIZE]
[SIZE=1]    [Monthly Production],
[/SIZE][SIZE=1][COLOR=#008000][SIZE=1][COLOR=#008000]FILTER[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=1] ([/SIZE]
[SIZE=1][COLOR=#008000][SIZE=1][COLOR=#008000]ALL[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=1] ( 'Calendar'[Date] ),[/SIZE]
[SIZE=1]        'Calendar'[Date] <= 
[/SIZE][SIZE=1][COLOR=#008000][SIZE=1][COLOR=#008000]MAX[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=1] ( 'Calendar'[Date] )[/SIZE]
[SIZE=1]    )
)
[/SIZE]
Would generate $30,000 in May 2017, $60,000 in June, etc.

I may have to write a macro to "spread" the initial values into a weekly or monthly set of rows for the term of the facility's production run and then import that as a table, but surely there's a simple DAX measure for this...?
 
Upvote 0
This measure does what I intended, but the nuances of having to use CALCULATETABLE are beyond me.

Code:
Monthly Forecast Pieces:=SUMX (
    CALCULATETABLE (
        tblPounds,
        FILTER (
            tblPounds,
            tblPounds[Start Date] <= MAX ( 'Calendar'[Date] )
        )
    ),
    tblPounds[Monthly Pieces]
)
 
Upvote 0

Forum statistics

Threads
1,214,419
Messages
6,119,389
Members
448,891
Latest member
tpierce

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