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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
cheryl0316
Helper I
Helper I

Create pie chart based on measure

This is a sample report regarding employee performance.

 

  • If an employee doesn't meet the sales target, he will receive a notice.
  • If an employee exceeds the maximum allowed refund amount, he will receive a notice.
  • If an employee doesn't meet both requirements, he will receive two notices.

 

The measure "Number_Notice" calculates the number of notices

cheryl0316_2-1735595954870.png

 

I want to calculate the number of notices based on each country, city, employee, and product category.

The measure works well in the table.

 

cheryl0316_1-1735595547802.png

I created a table for the slicer "Number of Notice". If the results returned by the measure "Number_Notice" match the slicer selections, they will be included.

e.g. I select Flag:1

cheryl0316_3-1735596247808.png

 

I want to create a pie chart in PowerBI to show the distribution of notices. This is an example created in Excel.

cheryl0316_4-1735596477335.png

 

I think there are 2 key points.

1. The calculation of the number of notices based on each country, city, employee, and product category works well in the table as long as I include the respective columns, but I'm not sure how to calculate it in a pie chart.

2. The pie chart needs to interact with the slicers. I'm not sure how to filter the pie chart based on the slicer selections for 'Number of Notices,' as it doesn’t have relationships with other tables.

 

Any advice would be appreciated. Thank you so much!

 

https://drive.google.com/file/d/1w_C86cENjnTki4k2gazHVTNyT1aa3Nac/view?usp=sharing 

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Power BI  (unlike Tableau) does not support dynamic bucketing.  You need to bring your own buckets, in a disconnected table - like you did in the "Notice"  table. You can then base your horrible pie chart on that table.

 

lbendlin_0-1735598958676.png

 

View solution in original post

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1735699778493.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

Power BI  (unlike Tableau) does not support dynamic bucketing.  You need to bring your own buckets, in a disconnected table - like you did in the "Notice"  table. You can then base your horrible pie chart on that table.

 

lbendlin_0-1735598958676.png

 

Thank you for your reply!

 

Just one question: Why can't we apply [Sum_Sales Amount] > 0 directly in 'Filters on this visual'?

cheryl0316_0-1735670801369.png

 

you need to group first before you can apply the measure filter. Otherwise it would attempt to filter the individual rows.

One more question:

 

How can I create a pie chart that shows the count for each notice type?

I want the pie chart to show:

  • Number of Sales Notices
  • Number of Refund Notices

Do I need to create a separate measure for each notice type?

You can change your buckets to represent notice types. (Sales or Refund)  Then adjust your measure accordingly

 

Are you sure a pie chart is the right chart for the data story you are trying to tell?

Yes I know that's a bit weird

I want to create a pie chart in PowerBI to show the distribution of each notice type. This is an example created in Excel

 

cheryl0316_0-1736190088966.png

I want to calculate the number of each notice type based on each country, city, employee, and product category.

The number of highlighted cells is same as the values shown for each notice type in the pie chart above

cheryl0316_1-1736190273117.png

 

My current thought:

1. Create a new table with a column called "Notice Type," which will be used as the Legend in the pie chart.

cheryl0316_2-1736190530601.png

2. Create a measure

NoticeTypeCount =
VAR Sales_Notice = IF([Sum_Sales Amount] < 100, 1, 0)
VAR Refund_Notice = IF([Sum_Refund Amount] > 10, 1, 0)
VAR a = SUMMARIZECOLUMNS(dimLocation[Country],dimLocation[City],dimEmployee[Employee Name],dimProduct[Product Category])
VAR b = ADDCOLUMNS(a, "Sales notice", Sales_Notice, "Refund notice", Refund_Notice, "Revenue amount", [Sum_Sales Amount])
return countrows(filter(b,[Revenue amount]>0))
 
I think var b is wrong because "Sales notice" and "Refund notice" should be grouped under a column (?)
I’m a bit confused when it comes to summarizing tables or columns. Any advice would be appreciated. Thank you for your help!
 
 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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