Forum Discussion
Need help on pie chart
- Anonymous1 year ago
Thanks for the reply from Kedar_Pande and pcoley , your replies are all fantastic! please allow me to provide some additional insights
Hi Anonymous ,
In Power BI, slice colours for pie charts do not currently support direct conditional formatting. However, you could achieve a similar effect with some workarounds.
1. Create a measure to calculate the average of each device.
AverageUtilization = AVERAGEX( SUMMARIZE( 'Table', 'Table'[Device], 'Table'[Month], "AvgUtilization", AVERAGE('Table'[Utilization]) ), [AvgUtilization] )2. Create a measure to determine the colour of each slice.
Device color = SWITCH( TRUE(), 'Table'[AverageProduction] < 50, "green", 'Table'[AverageProduction] >50 && 'Table'[AverageProduction] < 80, "grey", "Red" )3. Apply this colour measure in a bar chart or table.
4. Convert a bar chart or table to a pie chart. When I select green from the pie chart, I can see a list of devices belonging to the green category in the table visual object
Although pie charts themselves do not support conditional formatting, you can achieve a similar effect indirectly through this method.
Please refer to Power BI: Conditional formatting the Pie Visual - Microsoft Fabric Community
Could you please provide example data or sample files here if you have any confused? We could offer you more help if we have information in detail. There is sensitive data that can be removed in advance. How to provide sample data in the Power BI Forum - Microsoft Fabric Community
Thanks for your understanding. Your time and cooperation are much valued by us. We are looking forward to hearing from you to assist further.
Best regards,
Lucy Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Create a measure
Avg Utilization =
CALCULATE(
AVERAGE('Table'[Utilization]),
ALLEXCEPT('Table', 'Table'[Device], 'Table'[Month])
)
Create a calculated column
Category =
IF(
[Avg Utilization] < 50,
"Green",
IF([Avg Utilization] > 50 && [Avg Utilization] < 80,
"Amber",
"Red"
)
)
Best regards,
Kedar
🌐 Connect on LinkedIn
Hello Kedar, Thanks for reply. I have already mentioned that calculated column can not work here. Assume a device falls in all three categoires then in which category device will fall in Pie chart. In pie chart we have option to paas legend and count of devices. I can't pass average utilization measure.
- Kedar_Pande1 year ago
Super User
Anonymous
Insted of calculated column, create a measure:
Device Category =
VAR AvgUtilization = [Avg Utilization]
RETURN
IF(
AvgUtilization < 50,
"Green",
IF(AvgUtilization >= 50 && AvgUtilization < 80,
"Amber",
"Red"
)
)Since the measure calculates the overall category based on the average utilization of the device, it will assign the correct category (Green, Amber, or Red) for each device in the Pie chart based on its overall utilization.