Forum Discussion

c5966's avatar
c5966
Icon for Helper I rankHelper I
7 years ago
Solved

groups within timestamp on x-axis

Hi Team,

 

I would like to create groups as shown below for the timestamp to divide into different pasrt of the day. I would really appreciate any help :) I am very new to Power BI, still exploring new features.

 

 

Hour Class

 

My current graph looks like this.

 

I am expecting something like this.

 

 

Expected Output

 

Thanks in advance.

  • Hi c5966 

    You may add a column as below and use it as Axis.

    Column =
    SWITCH (
        TRUE (),
        TIME ( 6, 29, 0 ) >= [Time]
            && [Time] >= TIME ( 0, 0, 0 ), "Night",
        TIME ( 8, 59, 0 ) >= [Time]
            && [Time] >= TIME ( 6, 30, 0 ), "AM Peak",
        TIME ( 14, 59, 0 ) >= [Time]
            && [Time] >= TIME ( 9, 0, 0 ), "Midday",
        TIME ( 18, 29, 0 ) >= [Time]
            && [Time] >= TIME ( 15, 0, 0 ), "PM Peak",
        TIME ( 23, 29, 0 ) >= [Time]
            && [Time] >= TIME ( 18, 30, 0 ), "Evening"
    )
    

    Regards,

  • Hi,

     

    I did find the solution for that, I created the new column.

     

    Weekday = FORMAT(Dates[Date],"DDDD")

    This fixed the issue of weekday.

     

    Again thank you for your support.

     

    Thanks

4 Replies

  • v-cherch-msft's avatar
    v-cherch-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi c5966 

    You may add a column as below and use it as Axis.

    Column =
    SWITCH (
        TRUE (),
        TIME ( 6, 29, 0 ) >= [Time]
            && [Time] >= TIME ( 0, 0, 0 ), "Night",
        TIME ( 8, 59, 0 ) >= [Time]
            && [Time] >= TIME ( 6, 30, 0 ), "AM Peak",
        TIME ( 14, 59, 0 ) >= [Time]
            && [Time] >= TIME ( 9, 0, 0 ), "Midday",
        TIME ( 18, 29, 0 ) >= [Time]
            && [Time] >= TIME ( 15, 0, 0 ), "PM Peak",
        TIME ( 23, 29, 0 ) >= [Time]
            && [Time] >= TIME ( 18, 30, 0 ), "Evening"
    )
    

    Regards,

    • c5966's avatar
      c5966
      Icon for Helper I rankHelper I

      Hi Community Support Team _ Cherie Chen,

       

      This worked absolutely fine.

       

      I have one more question though.

       

      How do I make my data to show, days of the week like below screenshot?

       

      Appreciate all your help.

       

       

      Thanks in advance.

      • c5966's avatar
        c5966
        Icon for Helper I rankHelper I

        Hi,

         

        I did find the solution for that, I created the new column.

         

        Weekday = FORMAT(Dates[Date],"DDDD")

        This fixed the issue of weekday.

         

        Again thank you for your support.

         

        Thanks