Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Dave2534
Regular Visitor

Grouping Values in Pie Chart

Hello, 

 

I have a pie chart that has a legend of employee names and counts the amount of shifts they have had in the last 14 days. 

 

I am looking to count and group the results into three categories of red, amber green.

 

When i've tried adding a calculated column to show results as red, amber or green I am struggling to get it to calculate the last 14 records.

 

Dave2534_0-1660916837418.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Dave2534 ,

I created some data:

vyangliumsft_0-1661236091021.png

Here are the steps you can follow:

1. Create calculated column.

Switch =
SWITCH(
    TRUE(),
    'Table'[Count]>=0&&'Table'[Count]<=9,"Group1",
    'Table'[Count]>=10&&'Table'[Count]<=12,"Group2",
    'Table'[Count]>=13,"Group3")

2. Set the color for the [Switch] column.

vyangliumsft_1-1661236091022.png

3. Result:

vyangliumsft_2-1661236091028.png

If you need pbix, please click here.

Grouping Values in Pie Chart.pbix

 

Best Regards,

Liu Yang

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi  @Dave2534 ,

I created some data:

vyangliumsft_0-1661236091021.png

Here are the steps you can follow:

1. Create calculated column.

Switch =
SWITCH(
    TRUE(),
    'Table'[Count]>=0&&'Table'[Count]<=9,"Group1",
    'Table'[Count]>=10&&'Table'[Count]<=12,"Group2",
    'Table'[Count]>=13,"Group3")

2. Set the color for the [Switch] column.

vyangliumsft_1-1661236091022.png

3. Result:

vyangliumsft_2-1661236091028.png

If you need pbix, please click here.

Grouping Values in Pie Chart.pbix

 

Best Regards,

Liu Yang

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

Dave2534
Regular Visitor

Thank you for the assistance. 

 

I've attached the pbix, i have used the dates in period function in a calculated column. I am aiming to get the pie chart to show 1 staff member red, 2 amber, 1 green. And for this to update upon refresh of new records.

 

Sample 

onurbmiguel_
Power Participant
Power Participant

Hello Dave2534

 

So you need to catch the last 14 days and count the number of shifts? 

Creat a calculated column in the employee table where you will pick the last 14 days with the function dateadd (https://docs.microsoft.com/en-us/dax/dateadd-function-dax) .

if you have dificulty send a pbix example and i will try to help. 

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
Best Regards
BC

 


Best regards


Bruno Costa | Super User


 


Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! 


Take a look at the blog: PBI Portugal 


 


Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.