Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
allann
Contributor III
Contributor III

Need unique values from time field

We are extracting time intervals from a timestamp field. We would like to use this as a filter but the values are repeating. We only need a list of intervals from 12:00 am to 11:30 pm, so the list should only be 24 values. 

Load script currently:  Time(DateTime) as DateTimeIntervals

Labels (1)
1 Solution

Accepted Solutions
MarcoWedel

you maybe have to purge the date part using frac() as well:

 

Time(Floor(Frac(DateTime),1/48)) as DateTimeIntervals

View solution in original post

11 Replies
vinieme12
Champion III
Champion III

load distinct hour(Time(DateTime) ) as DateTimeIntervals

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
allann
Contributor III
Contributor III
Author

seems like that's the right track, but it gives me 0 to 23. actually the intervals are 30 min so the list should be 48 values.

i need it to show:

12:00 am

12:30 am

1:00 am

1:30 am and so on

edwin
Master II
Master II

this means your field have values that are more granular.  remember time is a dual, the number portion may be more granular than what you are displaying that may be why you are seeing duplicates though its not really dups as the number is different.  you may want to create a new field that is rounded off to the time intervals you need

allann
Contributor III
Contributor III
Author

that's what i was wondering. it didn't make sense to me that they weren't aggregating. let me look in to that.

MarcoWedel

Time(Floor(DateTime,'00:30:00')) as DateTimeIntervals

or

Time(Floor(DateTime,1/48)) as DateTimeIntervals
MarcoWedel

you maybe have to purge the date part using frac() as well:

 

Time(Floor(Frac(DateTime),1/48)) as DateTimeIntervals
allann
Contributor III
Contributor III
Author

thanks, this is what i was looking for!

allann
Contributor III
Contributor III
Author

Maybe I spoke to soon. It's working but when I choose an interval like 9:30PM, I'm seeing 9:30PM and 10PM. 

MarcoWedel

please post some sample data that shows this effect