Rearrange values on X axis



I am creating a view where I want to observe volumes base on a time of the day bucket. So have a variable: time_of_the day that I created using a timestamp variable. When I put the variable on the x axis, it starts with 10-11 AM first and and with the earliest value, 9-10 AM. I would like to organize the values in a way that it starts with 7-8AM though. How can I solve this problem?


Best Answer

  • GrantSmith
    GrantSmith Indiana 🟤
    Accepted Answer

    No, you'd have two separate beast modes. One for your values and another for your sorting.



    case when timestamp_var::time between '07:00:00' and '08:00:00' then '7-8 AM'



    case when timestamp_var::time between '07:00:00' and '08:00:00' then 1



    Although now seeing your beastmode - are you just breaking it down into hour buckets?


    You could possibly just do something like to do the sorting or even buckets if you don't care about AM/PM and can use 24-hour format:



    Are you doing this within a beast mode or in the sql query which pulls in the data?


  • GrantSmith
    GrantSmith Indiana 🟤

    Hi @user084060 


    If you want to do some custom sorting you can utilize the same methodology you're using to create your buckets by assigining values via a case statement (such that your first bucket would be 1, second is 2 etc) and then use that beast mode as a sort on your card.

  • Hi @GrantSmith ,


    So instead of just creating

    case when timestamp_var::time between '07:00:00' and '08:00:00' then '7-8 AM'

    put a 1 infront of it?

    when fact.start::time between '07:00:00' and '08:00:00' then '1_7-8 AM'

     If that works, it's definitely an option, I just hoped there is another (easier) way ?

  • GrantSmith
    GrantSmith Indiana 🟤

    Also based on your current logic if the timestamp fell exactly on 8:00:00 AM your code would cause it to always fall within the 7-8AM bucket and not the 8-9am bucket. You might want to change your BETWEEN to use '07:59:59' instead of '08:00:00' since BETWEEN is inclusive.

This discussion has been closed.

Hey, Stranger!

It looks like you're new here. Those who sign in get access to engage with even MORE fire content. To get involved, click one of these buttons!