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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
kaylaramsey2
Partner - Contributor III
Partner - Contributor III

Creating a Date Range

I need to create date ranges in my dimension...

What I have:

Date

1/1/2018

1/2/2018

1/3/2018

2/1/2018

2/2/2018

2/3/2018

What I need:

Date

1/1/2018 - 1/3/2018

2/1/2018 - 2/3/2018

Can someone help with this?

3 Replies
vishsaggi
Champion III
Champion III

may be this one way of doing it?

DateConversion:

LOAD *, Month(DateField) AS DateID INLINE [

DateField

1/1/2018

1/2/2018

1/3/2018

2/1/2018

2/2/2018

2/3/2018

3/1/2018

3/2/2018

3/3/2018

];

LEFT JOIN(DateConversion)

LOAD DateID,

     Date(Min(DateField),'M/D/YYYY')&'-'&Date(Max(DateField),'M/D/YYYY') AS DateRange

Resident DateConversion

Group By DateID;

kaylaramsey2
Partner - Contributor III
Partner - Contributor III
Author

I don' think an inline table will work.  This is just an example.  We have data dating back to 2017.  It would end up being a massive inline table that I would have to come back and update constantly.

vishsaggi
Champion III
Champion III

My friend, you do not have to use Inline table, the above i just used based on your data sample. Replace your inline table with your actual table. And just create an additional column DateId in your load table then use left join. Hope you get it.