Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE

Why should synthetic keys be removed from QlikView applications?

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
Sonja_Bauernfeind
Digital Support
Digital Support

Why should synthetic keys be removed from QlikView applications?

Last Update:

May 10, 2022 3:25:39 PM

Updated By:

Jamie_Gregory

Created date:

Feb 6, 2013 11:57:18 AM

Attachments

This example has the following conditions:

  • Show the Total Sales during a period of time
  • Show the Average Sales during a period of time

A straight table showing the results:

Sum of Sales Table.png

 

Sum of Sales is showing the correct value 2+16+5+4+4+2+7+11=51

Average Sales  is showing 5,1 i.e. 51/10=5,1 and that seems to be correct according to the table above, but the value isn't correct based on the loaded data.

 

Average Sales Script.png

 

From the source table Transaction there are only 8 Sales occurrences. Expected result for Average Sales is 51/8=6,375.

 

Resolution

 

The data model must be adjusted so that the two table only have one common field, which will resolve the synthetic key.

In this case only the field SalesPerson in table SalesPerson will be loaded.  

LOAD SalesPerson.png

 

The synthetic key is resolved and a new key created:

SalesPerson Syn keys.png

Both Sum of Sales and Average Sales are now displaying the expected and correct values:

Sum of Sales Table 2.png

Synthetic keys aren't always the root cause when something goes wrong but it can be hard to foresee what the impact might be. Therefore, always make sure that synthetic keys are removed from the data model. 

 

Cause

The issue appears because of a synthetic key in the data model. The synthetic key is show as table named with $Syn as prefix.

Syn Keys.png

Two extra rows appear:

Sum of Sales Table 3.png

This happens because of the synthetic key and is a result of values found in table SalesPerson:

SalesPerson Syn keys 02.png

 

Labels (1)
Version history
Last update:
‎2022-05-10 03:25 PM
Updated by: