Actual vs Forecast in Aggregated sums

zakkair

New Member
Joined
Jan 29, 2013
Messages
39
Hi,

I have an Excel file that currently compares the Actual data coming in vs the Forecast.

The forecast is given in months (example: Volume in Calgary is 200,000L for the month of January).

The actual data coming in is in days (example: volume for calgary on January 1st is 4,500L)

I want to make an aggregated line chart that compares the two. So for forecast, it starts a 0L and goes up by the daily volume, while the forecast is a fixed straight line going up. How would I do this in DAX?

Thanks in advance for the help. I greatly appreciate it :)

Sample doc:


Actual Acquired
[TABLE="width: 772"]
<TBODY>[TR]
[TD]Product 2</SPAN>
[/TD]
[TD]Contract</SPAN>
[/TD]
[TD]Region</SPAN>
[/TD]
[TD]Business Group</SPAN>
[/TD]
[TD]Supply Orbit</SPAN>
[/TD]
[TD]Supply Region</SPAN>
[/TD]
[TD]Supplier</SPAN>
[/TD]
[TD]Product</SPAN>
[/TD]
[TD]Brand</SPAN>
[/TD]
[TD]Terminal</SPAN>
[/TD]
[TD]Load Date</SPAN>
[/TD]
[TD]Volume</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/9/2013</SPAN>
[/TD]
[TD="align: right"]7139</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD #1</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/10/2013</SPAN>
[/TD]
[TD="align: right"]2016</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/10/2013</SPAN>
[/TD]
[TD="align: right"]3011</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/11/2013</SPAN>
[/TD]
[TD="align: right"]4524</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/11/2013</SPAN>
[/TD]
[TD="align: right"]5736</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/11/2013</SPAN>
[/TD]
[TD="align: right"]6027</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/11/2013</SPAN>
[/TD]
[TD="align: right"]6027</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/11/2013</SPAN>
[/TD]
[TD="align: right"]6032</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/17/2013</SPAN>
[/TD]
[TD="align: right"]7036</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/17/2013</SPAN>
[/TD]
[TD="align: right"]10576</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD #1</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/18/2013</SPAN>
[/TD]
[TD="align: right"]1414</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/18/2013</SPAN>
[/TD]
[TD="align: right"]7034</SPAN>
[/TD]
[/TR]
[TR]
[TD]Premium gas</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]PRM</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/21/2013</SPAN>
[/TD]
[TD="align: right"]1010</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/21/2013</SPAN>
[/TD]
[TD="align: right"]3523</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/22/2013</SPAN>
[/TD]
[TD="align: right"]2215</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/22/2013</SPAN>
[/TD]
[TD="align: right"]11072</SPAN>
[/TD]
[/TR]
[TR]
[TD]ULSD</SPAN>
[/TD]
[TD]Joe - Gas</SPAN>
[/TD]
[TD]West</SPAN>
[/TD]
[TD]WHOLESALE</SPAN>
[/TD]
[TD]Burnaby</SPAN>
[/TD]
[TD]Pacific</SPAN>
[/TD]
[TD]Joe</SPAN>
[/TD]
[TD]DIS</SPAN>
[/TD]
[TD]Unbranded</SPAN>
[/TD]
[TD="align: right"]10227</SPAN>
[/TD]
[TD="align: right"]1/22/2013</SPAN>
[/TD]
[TD="align: right"]3827</SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]

Forecast
[TABLE="width: 1499"]
<TBODY>[TR]
[TD]Supplier</SPAN>[/TD]
[TD]Contract</SPAN>[/TD]
[TD]Region2</SPAN>[/TD]
[TD]Orbit</SPAN>[/TD]
[TD]Brand</SPAN>[/TD]
[TD]Lift Point</SPAN>[/TD]
[TD]Product Class</SPAN>[/TD]
[TD]Product</SPAN>[/TD]
[TD]Product Detail</SPAN>[/TD]
[TD] Jan 2013 </SPAN>[/TD]
[TD] Feb 2013 </SPAN>[/TD]
[TD] Mar 2013 </SPAN>[/TD]
[TD] Apr 2013 </SPAN>[/TD]
[TD] May 2013 </SPAN>[/TD]
[TD] Jun 2013 </SPAN>[/TD]
[TD] Jul 2013 </SPAN>[/TD]
[TD] Aug 2013 </SPAN>[/TD]
[TD] Sep 2013 </SPAN>[/TD]
[TD] Oct 2013 </SPAN>[/TD]
[TD] Nov 2013 </SPAN>[/TD]
[TD] Dec 2013 </SPAN>[/TD]
[TD]Total</SPAN>[/TD]
[/TR]
[TR]
[TD]Joe</SPAN>[/TD]
[TD]Joe - Gas</SPAN>[/TD]
[TD]West</SPAN>[/TD]
[TD]Pacific</SPAN>[/TD]
[TD]Unbranded</SPAN>[/TD]
[TD]Burnaby</SPAN>[/TD]
[TD]Gas</SPAN>[/TD]
[TD]Premium gas</SPAN>[/TD]
[TD]Premium gas</SPAN>[/TD]
[TD] 200,000 </SPAN>[/TD]
[TD] 300,000 </SPAN>[/TD]
[TD] 300,000 </SPAN>[/TD]
[TD] 300,000 </SPAN>[/TD]
[TD] 400,000 </SPAN>[/TD]
[TD] 400,000 </SPAN>[/TD]
[TD] 400,000 </SPAN>[/TD]
[TD] 400,000 </SPAN>[/TD]
[TD] 400,000 </SPAN>[/TD]
[TD] 300,000 </SPAN>[/TD]
[TD] 300,000 </SPAN>[/TD]
[TD] 300,000 </SPAN>[/TD]
[TD]########</SPAN>[/TD]
[/TR]
[TR]
[TD]Joe</SPAN>[/TD]
[TD]Joe - Gas</SPAN>[/TD]
[TD]West</SPAN>[/TD]
[TD]Pacific</SPAN>[/TD]
[TD]Unbranded</SPAN>[/TD]
[TD]Burnaby</SPAN>[/TD]
[TD]Gas</SPAN>[/TD]
[TD]E10</SPAN>[/TD]
[TD]E10</SPAN>[/TD]
[TD] 2,200,000 </SPAN>[/TD]
[TD] 1,700,000 </SPAN>[/TD]
[TD] 1,700,000 </SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD] 1,700,000 </SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[/TR]
[TR]
[TD]Joe</SPAN>[/TD]
[TD]Joe - Gas</SPAN>[/TD]
[TD]West</SPAN>[/TD]
[TD]Pacific</SPAN>[/TD]
[TD]Unbranded</SPAN>[/TD]
[TD]Burnaby</SPAN>[/TD]
[TD]Distillate</SPAN>[/TD]
[TD]ULSD</SPAN>[/TD]
[TD]ULSD</SPAN>[/TD]
[TD] 2,000,000 </SPAN>[/TD]
[TD] 2,000,000 </SPAN>[/TD]
[TD] 2,000,000 </SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD] 2,000,000 </SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[TD]########</SPAN>[/TD]
[/TR]
[TR]
[TD]Joe</SPAN>[/TD]
[TD]Joe - Gas</SPAN>[/TD]
[TD]West</SPAN>[/TD]
[TD]Pacific</SPAN>[/TD]
[TD]Unbranded</SPAN>[/TD]
[TD]Burnaby</SPAN>[/TD]
[TD]Distillate</SPAN>[/TD]
[TD]ULSD</SPAN>[/TD]
[TD]ULSD #1</SPAN>[/TD]
[TD] 200,000 </SPAN>[/TD]
[TD] 150,000 </SPAN>[/TD]
[TD="align: right"]150000</SPAN>[/TD]
[TD="align: right"]100000</SPAN>[/TD]
[TD="align: right"]0</SPAN>[/TD]
[TD="align: right"]0</SPAN>[/TD]
[TD="align: right"]0</SPAN>[/TD]
[TD="align: right"]0</SPAN>[/TD]
[TD="align: right"]0</SPAN>[/TD]
[TD="align: right"]150000</SPAN>[/TD]
[TD="align: right"]200000</SPAN>[/TD]
[TD="align: right"]125000</SPAN>[/TD]
[TD="align: right"]1075000</SPAN>[/TD]
[/TR]
</TBODY><COLGROUP><COL><COL><COL><COL><COL span=4><COL span=4><COL span=2><COL><COL span=7></COLGROUP>[/TABLE]
 
Last edited:

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
I have already created a Actual vs Forecast in that way but it is the total comparison of each month. I want to make an aggregated chart to compare daily volume.

Right now, I'm looking to split the forecast into individual days. Example: Jan 2013 forecast is 300,000, so I want to split that off into
Jan 1: 300000/31*1, Jan 2: 300000/31*2, Jan 3: 300,000/31*3.... to make an aggregate line chart for forecast.

This way, I can compare it to my daily actuals, Jan 1, we got 280,000, Jan 2 would be 280000(jan 1 data) + Jan 2 data.

Is this possible using formulas on DAX based on the format of my 2 tables or do I have to manually create the tables. I want to be able to filter it with slicers so I can get daily comparisions for different regions.
 
Upvote 0
I have created a totalMTD for lift actuals --> totalmtd(sum('Lift Actuals'[Volume]), 'Lift Actuals'[Load Date])

I also created a measure that divide my budget january by 31. How do I make Measure 2 also aggreggate?
Similar to this:
[TABLE="width: 519"]
<TBODY>[TR]
[TD]Row Labels
[/TD]
[TD]Sum of Volume
[/TD]
[TD][/TD]
[TD]MTD Sum Lift Actual
[/TD]
[TD]Measure 2
[/TD]
[/TR]
[TR]
[TD]1/1/2013</SPAN>
[/TD]
[TD="align: right"]5,115,814</SPAN>
[/TD]
[TD="align: right"][/TD]
[TD]5,115,814 </SPAN>
[/TD]
[TD="align: right"]11.70967742</SPAN>
[/TD]
[/TR]
[TR]
[TD]1/2/2013</SPAN>
[/TD]
[TD="align: right"]13,207,893</SPAN>
[/TD]
[TD="align: right"][/TD]
[TD]18,323,706 </SPAN>
[/TD]
[TD="align: right"]11.70967742</SPAN>
[/TD]
[/TR]
[TR]
[TD]1/3/2013</SPAN>
[/TD]
[TD="align: right"]11,507,828</SPAN>
[/TD]
[TD="align: right"][/TD]
[TD]29,831,534 </SPAN>
[/TD]
[TD="align: right"]11.70967742</SPAN>
[/TD]
[/TR]
[TR]
[TD]1/4/2013</SPAN>
[/TD]
[TD="align: right"]11,787,756</SPAN>
[/TD]
[TD="align: right"][/TD]
[TD]41,619,290 </SPAN>
[/TD]
[TD="align: right"]11.70967742</SPAN>
[/TD]
[/TR]
[TR]
[TD]1/5/2013</SPAN>
[/TD]
[TD="align: right"]9,661,009</SPAN>
[/TD]
[TD="align: right"][/TD]
[TD]51,280,299 </SPAN>
[/TD]
[TD="align: right"]11.70967742</SPAN>
[/TD]
[/TR]
</TBODY>[/TABLE]
 
Upvote 0
Maybe you want to write this:
Code:
M2YTD := SUMX( DATESYTD( 'Lift Actuals'[Load Date] ), [Measure 2] )
 
Upvote 0
Hi Marco, it works really good for the annual data. Thanks a lot :D

How would I fix the formula for it to be split off into months. For example, right now when I filter the month-year to only show February 2013 data, the M2YTD starts off at the total of January 2013. How would I change the measure to make it start off at February 2013. My MTD Sum Lift Actual starts over from the beginning of Feb when I filter it. I was hoping the M2YTD would too.

Nevermind! I went around it and did this:
sumx(Datesytd('Lift Actuals'[Load Date]), [BU Forecast Daily Feb])-31*[bu forecast daily feb]

for another pivot table underneath and filtered it to February month only so I can compare the monthly data. It seems to work, just need to write a new measure for every month.

Thanks a lot! If there's another way to make it easier, I'll be so thankful!
 
Last edited:
Upvote 0
If you want a running total (which is not a YTD, but a running total of visible data in the PivotTable), use this:
Code:
M2YTD := SUMX( DATESYTD( ALLSELECTED( 'Lift Actuals'[Load Date] ) ), [Measure 2] )
 
Upvote 0

Forum statistics

Threads
1,223,939
Messages
6,175,530
Members
452,651
Latest member
wordsearch

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