Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a trend line chart. and I would like to sort this chart by the time bucket filed which I created.
I calculate the Time Bucket field as follows:
Time(frac([Date]),'h tt') & ' - ' & Time(frac([Date]) + maketime(1,0,0),'h tt') as TimeBucket
How do I sort this field? so that it shows the data in the right format eg: 5 am - 6 am, 6 am - 7 am, 7 am - 8 am and so on.
Can you sort my expression =[Date]?
Yes I tried. Its giving the same result. Its not sorting
Can you share your sample app?
So that we can perform tests?
It will be more helpful if we have the actuals dates to work with.
Dual(Time(Frac(Date),'h tt') & ' - ' & Time(Frac(Date) + MakeTime(1,0,0),'h tt'), Hour(Date)) as TimeBucket
Dual(Time(Date,'h tt')&' - '&Time(Date+'01:00','h tt'), Hour(Date)) as TimeBucket
sorting numerically
hope this helps
regards
Marco
Edit: shorter expression without unnecessary Frac() function when creating the text part of the dual-values.
Hi,
one example:
table1:
LOAD *,
Dual(Time(Date,'h tt')&' - '&Time(Date+'01:00','h tt'), Hour(Date)) as TimeBucket;
LOAD Timestamp(Now()-Rand()*100) as Date
AutoGenerate 100;
hope this helps
regards
Marco
Hi Marco,
I tried using the dual function in my load script
and sorting the data numerically:
I am still getting the same result. Its not sorting yet.
Can you tell me where am I going wrong?
try to drag "TimeBucket" to position 1.
regards
Marco
Great!. It works. I am very new to Qliksense and thank you so much for your inputs. What is the significance of moving the field to position1?
changing the position rearranges the sorting order:
Change the sorting of a visualization
hope this helps
regards
Marco