Forum Discussion

IF's avatar
IF
Post Prodigy
5 years ago
Solved

chart with grouped data

Hi,

I have the following data. I am using Name and Date columns at slicers. (the table looks stange, but should work with copy-paste).

 

NameStatusStatusKeyHoursDate

XOn time2112/2/2020
XOn time2212/2/2020
XOn time2-112/2/2020
XOn time2-212/2/2020
XOn time2012/2/2020
XOn time2312/2/2020
XOn time2312/2/2020
XOn time2312/2/2020
XLate3112/2/2020
XLate3212/2/2020
XLate3312/2/2020
XLate3812/2/2020
XLate31012/2/2020
XEarly1-112/2/2020
XEarly1-212/2/2020
XEarly1-212/2/2020
XEarly1-1412/2/2020
XEarly1-1112/2/2020
YOn time2012/2/2020
YOn time2-112/2/2020
YOn time2-312/2/2020
YOn time2-112/2/2020
YOn time2-212/2/2020
YOn time2212/2/2020
YOn time2312/2/2020
YOn time2312/2/2020
YOn time2312/2/2020
YLate3112/2/2020
YLate3212/2/2020
YLate3312/2/2020
YLate3812/2/2020
YLate31012/2/2020
YEarly1-112/2/2020
YEarly1-212/2/2020
YEarly1-212/2/2020
YEarly1-1412/2/2020
YEarly1-1112/2/2020
YLate3312/2/2020

 

I want to use a chart that show the count of the value:

 

I made a column to show the count, but it sums and doesn't show with different colours.

HoursStatusDP = switch(true(),
'Table'[Hours] = 0 , "0 Hours",
'Table'[Hours] = 1, "+1 Hour",
'Table'[Hours] = 2, "+2 Hours",
'Table'[Hours] = 3, "+3 Hours",
'Table'[Hours] = 4, "+4 Hours",
'Table'[Hours] = 5, "+5 Hours",
'Table'[Hours] = 6, "+6 Hours",
'Table'[Hours] >= 7, ">=+7 Hours",
'Table'[Hours] = -1, "-1 Hour",
'Table'[Hours] = -2, "-2 Hours",
'Table'[Hours] = -3, "-3 Hours",
'Table'[Hours] = -4, "-4 Hours",
'Table'[Hours] = -5, "-5 Hours",
'Table'[Hours] = -6, "-6 Hours",
'Table'[Hours] <= -7, "<=-7 Hours",
"Unknown"
)
How can I show values with different colours? Green(on time) should always be at the bottom.
The file is also available at: https://gofile.io/d/56DLU1
All the best,

5 Replies

  • gpiero's avatar
    gpiero
    Skilled Sharer

    IF

     

    Hi

    You could use the option for Data colors to have different colors

     

     

     

    Regards

  • IF's avatar
    IF
    Post Prodigy

    Hi, Thanks for the reply. However, I want to group the data in some bars. -2 days, -1day, 1day, 2days and 3 days bars have two different type of data. For example; Name X: -2 days/hours is 3 in total. However, 2 of 3 is for early and 1 is for on time. Similarly, 3 days/hours is in total 4. However, 3 of 4 is on time and 1 of 4 is late. Early should be yellow, ontime is green and late is red. As you see at the post, these bars have two different colours. I want to do it in this way. If I change as you mentioned, it changes the whole bar.

    All the best