Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
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.
Solved! Go to Solution.
Hi @Dave2534 ,
I created some data:
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.
3. Result:
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
Hi @Dave2534 ,
I created some data:
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.
3. Result:
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
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.
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