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: 
EvanBarrick
Creator
Creator

Add dates to a table

I have a data source that contains the following. My goal is to create a stacked bar chart that shows what type of medium was displayed on each day.  The data only had start and end dates. How do I fill in the gaps?

SourceMediumDate of PlacementEnd Date
SocSabFB23-Nov 1-DEC
SocSabTW23-Nov3-DEC 
SocSabINSTAS23-Nov29-DEC 
SocSabSNAP23-Nov25-NOV 
ESabIGSAB2326-Nov12-JAN 
ESabIGSAB235-Jan4-JAN 
NonDigitalBillboard5-Jan12-Jan
NonDigitalRadio1-Jan12-Jan
NonDigitalTV8-Jan 12-JAN
7 Replies
sunny_talwar

The start and end dates are only made up of day and month? No information about year?
EvanBarrick
Creator
Creator
Author

Correct

sunny_talwar

But then how do you determine if this has gone for a single year or multiple years?

image.png

For example from 26-Nov 2018 to 12-Jan-2019 or 12-Jan-2020? I mean there has to be some way to determine what is the duration between Start and End, right?

EvanBarrick
Creator
Creator
Author

Will work with source data to be added, can assume that going forward will be formatted as 'MM/DD/YYYY'

sunny_talwar

Something like this

Table:
LOAD *,
	 Date([Date of Placement] + IterNo() - 1) as Date
While Date([Date of Placement] + IterNo() - 1) <= [End Date];
LOAD * INLINE [
    Source, Medium, Date of Placement, End Date
    SocSab, FB, 23-Nov-2018, 1-Dec-2018
    SocSab, TW, 23-Nov-2018, 3-Dec-2018
    SocSab, INSTAS, 23-Nov-2018, 29-Dec-2018
    SocSab, SNAP, 23-Nov-2018, 25-Nov-2018
    ESab, IGSAB23, 26-Nov-2018, 12-Jan-2019
    ESab, IGSAB23, 5-Jan-2019, 4-Jan-2019
    NonDigital, Billboard, 5-Jan-2019, 12-Jan-2019
    NonDigital, Radio, 1-Jan-2019, 12-Jan-2019
    NonDigital, TV, 8-Jan-2019, 12-Jan-2019
];
EvanBarrick
Creator
Creator
Author

My data source is a .csv file that I would be loading in all data (there are more columns) how would I need to alter the script

sunny_talwar

Replace Inline load with CSV load 🙂