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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
AleRods88
Contributor III
Contributor III

Fill in Missing Rows from Date

Hello,

I have the following table with columns:

- DATE: Format DD/MM/YYYY

DATEYEAR_WEEKWEEKCAMPAIGNVALUEDAY
7/3/20202020-101019-205sat
14/3/20202020-111119-208sat
21/3/20202020-121219-203sat
28/3/20202020-131319-207sat
4/4/20202020-141419-204sat
11/4/20202020-151519-206sat
18/4/20202020-161619-208sat
25/4/20202020-171719-2025sat
2/5/20202020-181819-2010sat
3/5/20202020-191919-2010sun
4/5/20202020-191919-2010mon

 

So I need to generate a new row each day with the same data, except fields DATE and YEAR_WEEK (this field has the number of the week). And this would be my data on saturday 09/05/2020 (DD/MM/YYYY):

DATEYEAR_WEEKWEEKCAMPAIGNVALUEDAY
7/3/20202020-101019-205sat
14/3/20202020-111119-208sat
21/3/20202020-121219-203sat
28/3/20202020-131319-207sat
4/4/20202020-141419-204sat
11/4/20202020-151519-206sat
18/4/20202020-161619-208sat
25/4/20202020-171719-2025sat
2/5/20202020-181819-2010sat
3/5/20202020-191919-2010sun
4/5/20202020-191919-2010mon
5/5/20202020-191919-2010tue
6/5/20202020-191919-2010wed
7/5/20202020-191919-2010thu
8/5/20202020-191919-2010fri
9/5/20202020-191919-2010sat

 

But on sunday, 10/05 (DD/MM), I would need to delete those records in blue because when the week is over, I need to keep only the record from saturday:

DATEYEAR_WEEKWEEKCAMPAIGNVALUEDAY
7/3/20202020-101019-205sat
14/3/20202020-111119-208sat
21/3/20202020-121219-203sat
28/3/20202020-131319-207sat
4/4/20202020-141419-204sat
11/4/20202020-151519-206sat
18/4/20202020-161619-208sat
25/4/20202020-171719-2025sat
2/5/20202020-181819-2010sat
9/5/20202020-191919-2010sat
10/5/20202020-192019-2010sun

 

And then repeat the process automatically.

Is there any way to do that by script?

Thank you!

Labels (1)
1 Solution

Accepted Solutions
DesmoArka
Partner - Contributor III
Partner - Contributor III

hi,

maybe this helps you:

actual:
load *
from HISTORY.QVD(QVD)
where DAY=IF(WeekDay(Today())='sun','sat',DAY);
Concatenate
LOAD DATE(Today()) AS DATE,
Week(TODAY()) AS WEEK,
'19-20' AS CAMPAIGN,
Peek(VALUE) AS VALUE,
WeekDay(Today()) AS DAY,
Year(today()) & '-' & Week(today()) as YEAR_WEEK
AutoGenerate(1);

DROP Table history;

STORE * from actual into HISTORY.QVD(QVD);

View solution in original post

1 Reply
DesmoArka
Partner - Contributor III
Partner - Contributor III

hi,

maybe this helps you:

actual:
load *
from HISTORY.QVD(QVD)
where DAY=IF(WeekDay(Today())='sun','sat',DAY);
Concatenate
LOAD DATE(Today()) AS DATE,
Week(TODAY()) AS WEEK,
'19-20' AS CAMPAIGN,
Peek(VALUE) AS VALUE,
WeekDay(Today()) AS DAY,
Year(today()) & '-' & Week(today()) as YEAR_WEEK
AutoGenerate(1);

DROP Table history;

STORE * from actual into HISTORY.QVD(QVD);