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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add Unique ID to another table

I would like to add a unique sales rep to my employees table. I would like to select this unique sales rep and all other sales reps. All sales done by this sales rep would be tied to an order transaction ID. Every sale in the sales table has a unique ID (1 or 2) indicating the sale. I would all sales equal to 1 to be given to this unique sales rep. Then for this salesrep to be displayed in the 'employee list'.

So logic: add unique salesrep to employees table where order transaction id = 1 from sales table

Whatever orders have transaction id = 1 should then be given to this unique sales rep.

I hope this makes sense? I am unsure of how to proceed to do this in QV? I tried an inline load but am unsure of how to attach it to the employee table. I am not familiar enough with a Resident load but I think this would be key. Any ideas or thoughts on this matter would be greatly appreciated?

Thanks.

3 Replies
stephencredmond
Partner - Specialist II
Partner - Specialist II

Hi Jacob,

Sounds like you want to concatenate information into the SalesRep table:


Concatenate (SalesRep)
Load * INLINE [
SalesRepID, Name
XXX1, Special Rep
];


Then you need to have some If in the sales table:


...
if(transactionid=1, 'XXX1', SalesRepID) As SalesRepID,
...


Regards,

Stephen

Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

In order to do this, you need some sort of a link between the Employees Table and the Orders Table. Do you know the Employee ID for each Order? What fields are common between Orders and Employees?

Not applicable
Author

Thanks for the assistance. No direct lineage exists between the Employee and Orders table. Instead it linked through another table.

Sales history table. Link territory to sales table. The website does not need to show the association to a territory.



SalesHistory:
LOAD
text(BusinessEntityID) AS QBusinessEntityID,
TerritoryID AS Territory_ID;



Sales Table. Contains the transaction type for online or direct sales.




SalesHeader:
LOAD
APPLYMAP('OnlineOrDirectSales', OnlineOrderFlag) AS OrderTransactionType,
TerritoryID AS TerritoryID;




Employee table. Contains sales rep names.



Employee:
LOAD
text(EmployeeBusinessEntityID) AS QBusinessEntityID,
(LastName & ',' & FirstName & '.' & MiddleName) AS employeefullName,



Concatenation table to link 'Website' as an 'Employee' giving it a unique ID.




Concatenate (Employee)
Load * INLINE [
QBusinessEntityID, employeefullName
Website, Website
];




I can not include the 'if' statement in my sales table because employee and transaction type are in two separate tables.