Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
danaleota1
Creator
Creator

Creating dummy records for missing data in a table

I have the following table:

[SLATable]:

Load
Date,
INSTITUTIONAME,
INTSANS,
SL1,
SLA

FROM [lib://myqvd.qvd]
(qvd)

There are some INSTITUTIONNAME & Date combinations that won't always populate records for a given day Ion these dates I would still like records and have the SL1 field and INTSANS field to populate zeros so I have dummy records in order to populate a pivot table with accumulative sums.  How would I create dummy records in this case?  Thank you.  

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You should use the Cartesian product to generate the missing values. Like below.

Temp:
Load Distinct INSTITUTIONAME
FROM [lib://myqvd.qvd]
(qvd);

Join (Temp)

Load Distinct Date
FROM [lib://myqvd.qvd]
(qvd);

MainTable:
Load INSTITUTIONAME & '-'& Date as Key,
INSTITUTIONAME ,
Date
Resident Temp;

Drop table Temp;

Left join(MainTable)
Load *,INSTITUTIONAME & '-'& Date as Key
FROM [lib://myqvd.qvd]
(qvd);

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You should use the Cartesian product to generate the missing values. Like below.

Temp:
Load Distinct INSTITUTIONAME
FROM [lib://myqvd.qvd]
(qvd);

Join (Temp)

Load Distinct Date
FROM [lib://myqvd.qvd]
(qvd);

MainTable:
Load INSTITUTIONAME & '-'& Date as Key,
INSTITUTIONAME ,
Date
Resident Temp;

Drop table Temp;

Left join(MainTable)
Load *,INSTITUTIONAME & '-'& Date as Key
FROM [lib://myqvd.qvd]
(qvd);

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
danaleota1
Creator
Creator
Author

Hi Kaushik that worked.  My pivot table now has an accumulative count where there had been no records before.  

 

Thank you!