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: 
viveksingh
Creator III
Creator III

Populate missing date

Hi All,

i have data for only weekday and no data on weekend. Nd the my calendar date fiel doesn’t have weekend dates.

Here is sample

salesdatesales
1/8/2018100
2/8/201850
3/8/2018200
6/8/201860
7/8/2018310

if you observe above data, there is no data for weekends. And even if any date is missing then it should populate date nd sales should be 0 for those missing one.

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Perhaps this?

NullAsValue sales;

Set NullValue = '0';

Sales:

Load * Inline [

salesdate, sales

1/8/2018, 100

2/8/2018, 50

3/8/2018, 200

6/8/2018, 60

7/8/2018, 310

];

Load Date(MinDate + IterNo() -1 ) AS salesdate While (MinDate + IterNo() - 1) <= Num(MaxDate);

Load

    Min(salesdate) AS MinDate,

    Max(salesdate) AS MaxDate

RESIDENT Sales;

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

View solution in original post

4 Replies
qlikviewwizard
Master II
Master II

Anil_Babu_Samineni

Perhaps this?

NullAsValue sales;

Set NullValue = '0';

Sales:

Load * Inline [

salesdate, sales

1/8/2018, 100

2/8/2018, 50

3/8/2018, 200

6/8/2018, 60

7/8/2018, 310

];

Load Date(MinDate + IterNo() -1 ) AS salesdate While (MinDate + IterNo() - 1) <= Num(MaxDate);

Load

    Min(salesdate) AS MinDate,

    Max(salesdate) AS MaxDate

RESIDENT Sales;

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
ChennaiahNallani
Creator III
Creator III

create master calendar.

Master Calendar Script

thannila
Creator
Creator

DataSource:

load * Inline

[

salesdate, sales

1/8/2018, 100

2/8/2018, 50

3/8/2018, 200

6/8/2018, 60

7/8/2018, 310

];

Data:

Load Date(MinDate + IterNo() -1 ) AS salesdate

While (MinDate + IterNo() - 1) <= Num(MaxDate);

Load

    Min(salesdate) AS MinDate,

    Max(salesdate) AS MaxDate

RESIDENT DataSource;

LEFT JOIN(Data)

LOAD * Resident DataSource;

drop table DataSource;

NoConcatenate

Final:

load salesdate

,if(isnull(sales),0,sales)as sales

resident Data;

Drop Table Data;