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
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Chalklands

New Member
Joined
May 17, 2018
Messages
13
Hi,
Example of the data in each table:

Table 1
Sales Forecast
CustomerMonthSales Forecast
Customer X01/11/2018£728,945
Customer Y01/11/2018£271,203
Customer Z01/11/2018£165,207
Customer AA01/11/2018£96,732
Customer AB01/11/2018£41,923

<colgroup><col><col><col></colgroup><tbody>
</tbody>

Table 2
Sales_By_Customer
Invoice_DateInvoice NumberProduct codeDescriptionCustomer NameTotal Sales Value £s
01/11/2018432947227Product ACustomer X£20,000
01/11/2018427857228Product BCustomer Y£15,000
01/11/20184606471120Product CCustomer Z£13,000
01/11/2018435787771Product DCustomer AA£25,000
02/11/2018407497227Product ACustomer X£11,000
02/11/2018419717771Product DCustomer Y£45,000
02/11/2018448337286Product ECustomer Z£20,000
02/11/2018437017286Product ECustomer X£15,000

<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>


Hope this helps!

Pete
 

VBA Geek

MrExcel MVP
Joined
Dec 16, 2013
Messages
2,857
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.

 

Chalklands

New Member
Joined
May 17, 2018
Messages
13
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.

Thanks for your help, it all works now.

Thanks again!

Pete
 

Watch MrExcel Video

Forum statistics

Threads
1,102,370
Messages
5,486,453
Members
407,548
Latest member
FayP

This Week's Hot Topics

Top