Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
danielle_v
Creator
Creator

Linking 2 tables where not all data matches

Hi All,

I'm trying to do some analysis whereby I need to compare forecasted vs. actual volumes.

The actual volumes are already in Qlikview, and the forecasted volumes are read in from an Excel spreadsheet.

My issue is with handling records which do not match. As per the below table, the actual and forecasted volumes are linked by a key made up of Country and Supplier. Where there is a country and supplier with both actual and forecasted volume, everything works fine and correctly returns data. My issue is where there is a country/supplier with actual but not forecasted volume, or forecasted but not actual volume - like the yellow highlighted rows in the below example. In scenarios such as this, the record will not exist in the table of data - for example, Australia4 will not exist in my Excel forecast data.

CountrySupplierKEYActual VolumeForecasted Volume
China1China15040
India2India22050
UK3UK33030
Australia4Australia41000
USA5USA5020

Whatever I do, I can't get ALL of the data to show in my table, there's always something missing.

I'm hoping there's a straight-forward solution to this that I've missed - any help much appreciated!

5 Replies
anbu1984
Master III
Master III

In case of missing data, what do you want to do? Do you want to ignore such data in your chart?

maxgro
MVP
MVP

if you want to show the KEY with forecast and actual you can try with (same for actual)

if(sum([Forecasted Volume])>0 and sum([Actual Volume])>0,  sum([Forecasted Volume]))

in total mode use sum of rows

danielle_v
Creator
Creator
Author

Thanks for the responses on here, and so sorry for the delay in getting back to you.

I need to be able to include ALL records, regardless of whether they appear in the Actual Volume, the Forecasted Volume or both - so as per the example above, I need all 5 rows (including the yellow rows) to appear in my analysis.

I've tried left joining, but depending on which way I join, either the records where the Forecasted Volume is zero or the records where the Actual Volume is zero, are excluded.

I need to be able to get to a point where I can show the full picture of forecast and actuals, without any reocrds missing.

Any help still greatly appreciated!

jpapador
Partner - Specialist
Partner - Specialist

Try loading up the table with the actuals and then do an OUTER JOIN to bring in the forecast.  This way all records will be brought in.

You can then set Null values in the script to zero:

If(Len(Actual) = 0, 0, Actuals) as Actuals,

If(Len(Forecast) = 0, 0, Forecast) as Forecast

Not applicable

Another option you have is to concatenate the actual and forecast data and identify each with a data source field in the script.

You then have slightly modified expressions for actual and forecast using set analysis to limit to the relevant data source.

eg

Fact:

Load

Country

Supplier

Country & Supplier AS KEY

Volume

'Actual' AS DATA_SOURCE

from your actual source here

Concatenate(Fact)

Load

Country

Supplier

Country & Supplier AS KEY

Volume

'Forecast' AS DATA_SOURCE

from your forecast source here

Then your expressions become

Sum({<DATA_SOURCE={'Actual'}>} Volume)

Sum({<DATA_SOURCE={'Forecast'}>} Volume)

hope that helps

Joe