Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can anyone solve the following problem

When i reload the following script :

1)keys are generated .So how to resolve it

2) and after resolving the keys how to identify data of a perticular table.

Purchase:

LOAD [Purchase Invoice],

     [Purchase Date],

     SCCode,

     [Purchase Amount],

     Location ,

   

FROM

Try_Data.xlsx

(ooxml, embedded labels, table is Purchase);

Sales:

LOAD [Sales Invoice],

     [Sales Date],

     SCCode,

     [Sales Amount],

     Location,

  

FROM

Try_Data.xlsx

(ooxml, embedded labels, table is Sales);

[SC Master]:

LOAD SCCode,

     Name,

     Type,

     Location,

   

FROM

Try_Data.xlsx

(ooxml, embedded labels, table is [SC Master]);

5 Replies
PrashantSangle

Hi,

To resolve synthetic key first identify which field gives you unique combination with distinct data.

Try below code

Purchase:

LOAD [Purchase Invoice],

     [Purchase Date],

     SCCode,

     [Purchase Amount],

     Location as Purchase_Location,

   

FROM

Try_Data.xlsx

(ooxml, embedded labels, table is Purchase);

Sales:

LOAD [Sales Invoice],

     [Sales Date],

     SCCode,

     [Sales Amount],

     Location as Sales_Location,

  

FROM

Try_Data.xlsx

(ooxml, embedded labels, table is Sales);

[SC Master]:

LOAD SCCode,

     Name,

     Type,

     Location,

   

FROM

Try_Data.xlsx

(ooxml, embedded labels, table is [SC Master]);

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Kushal_Chawda

Please see the attached

Not applicable
Author

In your qvw file synthetic key is generted because of two fileds i.e SCCode and Location rename them in any of the table i shown in below code

Purchase:

LOAD [Purchase Invoice],

    
[Purchase Date],

    
SCCode,

    
[Purchase Amount],

    
Location

FROM



(
ooxml, embedded labels, table is Purchase);





Location:

LOAD Location,

    
[Location Name],

    
State

FROM



(
ooxml, embedded labels, table is LOcation);



sales:

LOAD [Sales Invoice],

    
[Sales Date],

    
SCCode,

    
[Sales Amount],

    
Location as location // rename the filed

FROM



(
ooxml, embedded labels, table is Sales);





scmaster:

LOAD SCCode as SC_code, // rename the field

     Name,

    
Type,

    
Location

FROM



(
ooxml, embedded labels, table is [SC Master]);

Not applicable
Author

You should consider using a composite key for convenience. I would usually avoid synthetic keys unless necessary. Possibly for your sales and purchase it could be subset of SCCODE and Location. I am not too sure what you are trying to achieve but i hope this helps.

how to create composite key

http://www.analyticsvidhya.com/blog/2014/11/synthetic-keys-qlikview-simplified/

sasiparupudi1
Master III
Master III

Untitled.jpg

Hi Gaurav

Use the following statement

QUALIFY Location;

this will not make the synthetic key and qualify the location field as purchase.loaction and sales.location etc

HTH