Using data from two tables with different granularity

Chalklands

New Member
Joined
May 17, 2018
Messages
13
Hi,
I have two data tables. One has actual sales by Customer and Product code (Sales_By_Customer). The second (Sales Forecast), contains a total sales forecast by Customer only. I'm trying to calculate and chart the variance to target for each customer. I've created this measure:


Target v actual £s = sum(Sales_By_Customer[Total Sales Value £s])-sum('Sales Forecast'[Sales Forecast])


This works when I use a Card visualisation to display the total variance, but when I try and create a bar chart to show variance by individual customer the chart shows complete rubbish!.


I think the issue is probably caused by using data at different levels of granularity.


Does anybody have any ideas/pointers that may help me solve this issue please?


Thanks


Pete
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hi,
Example of the data in each table:

Table 1
[TABLE="width: 370"]
<colgroup><col><col><col></colgroup><tbody>[TR]
[TD]Sales Forecast[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Customer[/TD]
[TD]Month[/TD]
[TD]Sales Forecast[/TD]
[/TR]
[TR]
[TD]Customer X[/TD]
[TD="align: right"]01/11/2018[/TD]
[TD="align: right"]£728,945[/TD]
[/TR]
[TR]
[TD]Customer Y[/TD]
[TD="align: right"]01/11/2018[/TD]
[TD="align: right"]£271,203[/TD]
[/TR]
[TR]
[TD]Customer Z[/TD]
[TD="align: right"]01/11/2018[/TD]
[TD="align: right"]£165,207[/TD]
[/TR]
[TR]
[TD]Customer AA[/TD]
[TD="align: right"]01/11/2018[/TD]
[TD="align: right"]£96,732[/TD]
[/TR]
[TR]
[TD]Customer AB[/TD]
[TD="align: right"]01/11/2018[/TD]
[TD="align: right"]£41,923[/TD]
[/TR]
</tbody>[/TABLE]

Table 2
[TABLE="width: 620"]
<colgroup><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Sales_By_Customer[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Invoice_Date[/TD]
[TD]Invoice Number[/TD]
[TD]Product code[/TD]
[TD]Description[/TD]
[TD]Customer Name[/TD]
[TD]Total Sales Value £s[/TD]
[/TR]
[TR]
[TD="align: right"]01/11/2018[/TD]
[TD="align: right"]43294[/TD]
[TD="align: right"]7227[/TD]
[TD]Product A[/TD]
[TD]Customer X[/TD]
[TD="align: right"]£20,000[/TD]
[/TR]
[TR]
[TD="align: right"]01/11/2018[/TD]
[TD="align: right"]42785[/TD]
[TD="align: right"]7228[/TD]
[TD]Product B[/TD]
[TD]Customer Y[/TD]
[TD="align: right"]£15,000[/TD]
[/TR]
[TR]
[TD="align: right"]01/11/2018[/TD]
[TD="align: right"]46064[/TD]
[TD="align: right"]71120[/TD]
[TD]Product C[/TD]
[TD]Customer Z[/TD]
[TD="align: right"]£13,000[/TD]
[/TR]
[TR]
[TD="align: right"]01/11/2018[/TD]
[TD="align: right"]43578[/TD]
[TD="align: right"]7771[/TD]
[TD]Product D[/TD]
[TD]Customer AA[/TD]
[TD="align: right"]£25,000[/TD]
[/TR]
[TR]
[TD="align: right"]02/11/2018[/TD]
[TD="align: right"]40749[/TD]
[TD="align: right"]7227[/TD]
[TD]Product A[/TD]
[TD]Customer X[/TD]
[TD="align: right"]£11,000[/TD]
[/TR]
[TR]
[TD="align: right"]02/11/2018[/TD]
[TD="align: right"]41971[/TD]
[TD="align: right"]7771[/TD]
[TD]Product D[/TD]
[TD]Customer Y[/TD]
[TD="align: right"]£45,000[/TD]
[/TR]
[TR]
[TD="align: right"]02/11/2018[/TD]
[TD="align: right"]44833[/TD]
[TD="align: right"]7286[/TD]
[TD]Product E[/TD]
[TD]Customer Z[/TD]
[TD="align: right"]£20,000[/TD]
[/TR]
[TR]
[TD="align: right"]02/11/2018[/TD]
[TD="align: right"]43701[/TD]
[TD="align: right"]7286[/TD]
[TD]Product E[/TD]
[TD]Customer X[/TD]
[TD="align: right"]£15,000[/TD]
[/TR]
</tbody>[/TABLE]


Hope this helps!

Pete
 
Upvote 0
You need to create a Customer dimension which filters both tables. Then you can slice easily by Customer.

In the link I pasted there're also techniques which explain how not to display the forecast if you're slicing data by something else which is not a customer, like product in your example.

HT25njK.png
 
Upvote 0
You need to create a Customer dimension which filters both tables. Then you can slice easily by Customer.

In the link I pasted there're also techniques which explain how not to display the forecast if you're slicing data by something else which is not a customer, like product in your example.

HT25njK.png
Thanks for your help, it all works now.

Thanks again!

Pete
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

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