Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Create copy for every record

Hi, I have 2 tables loaded in qvw.

empidempname
1employee1
2employee2
3employee3
4employee4

empidtrainingtrainingstatus
1training acomplete
1training bcomplete
2training bin progress
3training acomplete

This dashboard shows training completion across employees. I want to show that emloyee4 is not registered with both training. What happens when i load them is, emplooyee4 shows only not registered.  I would like to have every employee have records depending on how many training are available. I would like to have a data model that can create an output table like this:

empidempname  trainingtrainingstatus
1employee1training acomplete
1employee1training bcomplete
2employee2training bin progress
2employee2training anot registered
3employee3training acomplete
3employee3training anot registered
4employee4training anot registered
4employee4training bnot registered

I would like to achieve this without the data model suffering.

Thank you in advance for any help.

1 Solution

Accepted Solutions
Digvijay_Singh

Check this out -

I would not suggest to add empname in the newly created table to avoid synthetic key, it is already associated in the model through empid.

Employee:

Load * inline [

empid empname

1 employee1

2 employee2

3 employee3

4 employee4 ](delimiter is spaces);

training:

Load * inline [

empid, training, trainingstatus,

1, training a, complete

1, training b, complete

2, training b, in progress

3, training a, complete ];

Temp1:

Load empid

resident Employee;

Join

Load training

resident training;

left join(Temp1)

Load *

resident training;

NoConcatenate

Final:

Load empid,

  training,

  if(isnull(trainingstatus),'Not registered',trainingstatus) as trainingstatus

resident Temp1;

Drop table Temp1,training;

Capture.PNG

View solution in original post

5 Replies
Anil_Babu_Samineni

Without model suffering means are you expecting front-end??

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Not applicable
Author

Sorry. What I mean is that I will still have the employee table intact.

neelamsaroha157
Specialist II
Specialist II

Check this out

Digvijay_Singh

Check this out -

I would not suggest to add empname in the newly created table to avoid synthetic key, it is already associated in the model through empid.

Employee:

Load * inline [

empid empname

1 employee1

2 employee2

3 employee3

4 employee4 ](delimiter is spaces);

training:

Load * inline [

empid, training, trainingstatus,

1, training a, complete

1, training b, complete

2, training b, in progress

3, training a, complete ];

Temp1:

Load empid

resident Employee;

Join

Load training

resident training;

left join(Temp1)

Load *

resident training;

NoConcatenate

Final:

Load empid,

  training,

  if(isnull(trainingstatus),'Not registered',trainingstatus) as trainingstatus

resident Temp1;

Drop table Temp1,training;

Capture.PNG

Not applicable
Author

Thanks! That worked