Forum Discussion

Freeseman's avatar
Freeseman
Icon for Helper II rankHelper II
4 years ago
Solved

Average per category over 24h

Hi All,

 

Please help... Can i do this with Power Bi or do i need SQL to write the query?

 

I would like to split time categories up over a 24h period which i have done however i need to give an average based on each category. Below i have posted what i have acheived so far and then what i am trying to accomplish. 

Please help advise.

 

What i need:

 

  • Hi, Freeseman ;

    1.You could new a group column.

     

    Group = IF([hour]<5&&[hour]>=1,"group3",if ( [hour]=0,"group2",IF([hour]<9,"group4",IF([hour]<14,"group5",IF([hour]<18,"group6",IF([hour]<23,"group1","group2"))))))

     

    2.create a measure as condition format color.

     

    Measure = SWITCH(MAX('Table'[Group]),"group1","#01B8AA","group2","#FD817E","group3","#808080","group4","#8AD4EB","group5","#FD817E","#01B8AA")

     

    3.create a clustered column chart and set it.

    The final show:

     


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

1 Reply

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

    Hi, Freeseman ;

    1.You could new a group column.

     

    Group = IF([hour]<5&&[hour]>=1,"group3",if ( [hour]=0,"group2",IF([hour]<9,"group4",IF([hour]<14,"group5",IF([hour]<18,"group6",IF([hour]<23,"group1","group2"))))))

     

    2.create a measure as condition format color.

     

    Measure = SWITCH(MAX('Table'[Group]),"group1","#01B8AA","group2","#FD817E","group3","#808080","group4","#8AD4EB","group5","#FD817E","#01B8AA")

     

    3.create a clustered column chart and set it.

    The final show:

     


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.