Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

display date and hours in graph

Hello,

 

I try to make 2 graphs (stack column chart):

one showing days in x axis and the other one showing hours in x axis.

I got this

instead of this format that I am looking for: 

And for hours I got this: 

 

instead of this format that I am looking for:

 

Thanks!

  • Anonymous , In X=axis, choose type = categorical in place of continuous

     

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi,

     

    It worked for the days graph:

     

    but not for the hours, also the date displyed there are wrong.

    the hours column are like this in the data:

    Thanks

     

4 Replies

  • Anonymous , In X=axis, choose type = categorical in place of continuous

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi,

       

      It worked for the days graph:

       

      but not for the hours, also the date displyed there are wrong.

      the hours column are like this in the data:

      Thanks

       

      • v-zhenbw-msft's avatar
        v-zhenbw-msft
        Icon for Community Support rankCommunity Support

        Hi Anonymous ,

         

        Maybe you can create a new column to group the time.

         

        Please refer the following.

        We create a sample and create a calculate column to meet your requirement.

         

        Column = 
        SWITCH(
            TRUE(),
            'Table'[Custom]>=TIME(0,0,0) && 'Table'[Custom]<TIME(3,0,0),"02:00:00",
            'Table'[Custom]>=TIME(3,0,0) && 'Table'[Custom]<TIME(5,0,0),"04:00:00",
            'Table'[Custom]>=TIME(5,0,0) && 'Table'[Custom]<TIME(7,0,0),"06:00:00",
            'Table'[Custom]>=TIME(7,0,0) && 'Table'[Custom]<TIME(9,0,0),"08:00:00",
            'Table'[Custom]>=TIME(9,0,0) && 'Table'[Custom]<TIME(11,0,0),"10:00:00","Others")//You can continue to sort down

         

         

        If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

         

        Best regards,

         

        Community Support Team _ zhenbw

        If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

         

        BTW, pbix as attached.