Forum Discussion
Rank text on X axis: Duration type
Hi everyone,
I am trying to plot a time series over 24 hours in a day. My x-axis data looks like this:
0-1 stands for the counts in 00:00-01:00 and 23-24 stands for 23:00-24:00.
To make sure that the x axis is in the time order insteand of text order, I currently have two ideas:
1. create a new column to and manually input corresponding rank and sort my "time range" by that new column. But this means repeated work which I tend to avoid.
2. change the data type of "time range" to some supported time-related data type like "Duration". How to achieve this though?
Thank you for all your help!
5 Replies
- Greg_Deckler
Community Champion
Why would the first option need repeated work? If you have a related table with time_range and time_range_sort, then that table should be absolutely static within your data model.
- rliu
Helper I
Hi Greg_Deckler,
So
1. when creating the time range order, don't I have to manually input 1-24 correspondingly?
2. the idea of using releted table sounds good. But I don't know how to do that. Can you elaborate it?
Thanks
- Greg_Deckler
Community Champion
Yes, you would have to enter it one time manually. Easiest way to do this is to use Enter Data and just put in your time_range column and your time_range_sort column manually. Close that and set your "Sort By". Then use the Relationships pane (3rd icon down on the left-hand side in Desktop) and drag time_range column from one table to your new "lookup" table. Then, use the time_range column from your new "lookup" table in your visuals.
- rliu
Helper I
I solved the problem by replacing 1-2 with 01-02 and 3-4 with 03-04 etc.
Still would like to know how to do it by taking advantage of the supported data type. So welcome to share!