Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_chan
Specialist
Specialist

How to create composite key

Hi guys,

I need to create a composite key for these 2 tables.  After loaded in the Sales Target Data. i got a synthetic key.

When i tried to create a composite key in my orders table - EmployeeID & '|' & Month & '|' & Year as Order_key, i got error as such.


How to create a composite for both of these table?

error.jpg

error.jpg

Orders:

LOAD OrderID,

     Month(OrderDate) as Month,

     Day(OrderDate) as Day,

     OrderDate,

     EmployeeID,

     CustomerID,

     ProductID,

     APPLYMAP('Product_Details',ProductID,null()) as Product_Made,

     ShipperID,

     Year, 

     Sales,

     Cost,

     Quantity

   

FROM

[Data Source\Order.xlsx]

(ooxml, embedded labels, table is Order);

Sales_Target:

LOAD

EmployeeID,

     Year,

     Month,

     Target

FROM

[Data Source\Sales_Target.xlsx]

(ooxml, embedded labels, table is Sheet1);

Rgds

Jim

1 Solution

Accepted Solutions
robert_mika
Master III
Master III

Try:

EmployeeID & '|' & Month(OrderDate) & '|' & Year


make sure that both Month fields are in the same format.

View solution in original post

3 Replies
robert_mika
Master III
Master III

Try:

EmployeeID & '|' & Month(OrderDate) & '|' & Year


make sure that both Month fields are in the same format.

jim_chan
Specialist
Specialist
Author

The orderdate is orders table is dd/mm/yyyy(13/01/2016) and month is sale target table is "Jan".

is it same date format?

robert_mika
Master III
Master III

Should be fine.

Create Listbox in front end with value 'Month' to check if all entries are in the same format.