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: 
Not applicable

Duplicate dates within my Master Calendar

When I create my Master Calendar I am getting multiple dates (basically i'm getting dates for each and every row of my data).

Example of MasterCalendar output:

11/13/2013

11/13/2013

11/13/2013

11/13/2013

11/14/2013

11/14/2013

11/14/2013

11/15/2013

11/15/2013

The code originally LOADS the data in like this:

LOAD Distinct

DATE(STARTTIME)     AS [CALL DATE],

MONTH(STARTTIME)      AS [CALL MONTH],

fieldA,

fieldB,

and so on.

When i create the Min/Max dates, everything appears fine.

When i create the TempCal like so:

TempCal:

LOAD

     Date($(vMinDate)+rowno()-1)AS TempDate

AutoGenerate

     $(vMaxDate)-$(vMinDate)+1;

Drop Table MinMax;

This also shows only one date:

11/13/2013

11/14/2013

11/15/2013

However, when i create the Master Calendar (as shown below) i get multiples.

MasterCalendar:

LOAD Distinct

TempDate AS [Call Date]

Resident

     TempCal

Order By TempDate ASC;

Drop Table TempCal;

How do I prevent duplicates date in my Master Calendar, yet create a connection back to my original table?

(I have read other posts that state to only use a "Date" Field and not a "Date/Time" field, however this table only has the Date/Time Field to use.

In addition, pulling out the Date from the Load script from above and doing a distinct in the creation of the MasterCalendar should take care of that issue but it is not.

Thanks

Labels (1)
1 Solution

Accepted Solutions
Nicole-Smith
MVP
MVP

You should only use a Date Field and not a Date/Time field.  To get rid of the time, wrap the field in floor():

DATE(floor(STARTTIME))

View solution in original post

4 Replies
Nicole-Smith
MVP
MVP

You should only use a Date Field and not a Date/Time field.  To get rid of the time, wrap the field in floor():

DATE(floor(STARTTIME))

Not applicable
Author


Thank you Nicole, That did the trick.

Anonymous
Not applicable
Author

If you have STARTTIME values like this

01/28/2013 10:00

01/28/2013 10:30

01/28/2013 11:00

They are three different values, even if you show them as date.  The floor(STARTDATE) removes time portion, and you get one value 01/28/2013.

Nicole-Smith
MVP
MVP

Please mark correct and helpful answers so others can find solutions to their problems too