Forum Discussion
Text Measure as legend in Pie chart
I have a table, through which it calculates Month's cover of Stock.
For this the user inputs the Number of Months as a variable and I have used what if parameter for this. So, if user enters 3 , it calculates sum of last 3 months of sales and divide current stock on hand by the sum of last 3 months sales to give Number of month's cover.
Now I need to create Pie chart of this depending on the Month's cover calculation. So if the answer is between 0-5 then pie chart slice is green, if month's cover is 6-10 then yellow and above that it should be red..
All my month's cover, sum of sales are measures. I can't get how to make a legend on pie chart based on 0-5,6-10 and greater that 10 for this.
7 Replies
- vicky_
Super User
I don't think you can use measures in the legend. But you can create a measure for each of the groups and add each measure to the Values section.
- chengshufangNew Member
You need to create a column by clicking the 3 dots next to your table, choose "New column". You will see a window appears like when you create a new meausre. Put in: newcolumn = tablename[meausername]
Choose your pie char, drag the newcolumn to Legend and Values.
- AnonymousNot applicable
Hi learner03 ,
Here's a possible idea.
You can create a seperate table for the range.
Use the SWITCH function to judge the different results of fan'h.
Measure = SWITCH(MAX('Table (2)'[Legend]),"0-5",[Expression1],"6-10",[Expression2]))Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- learner03
Post Partisan
Anonymous I used this approach from one of the videos and could create the chart, but there is a table underneath it which has details about items associated with customers. I also have slicers to select customers. The working should be when I click on a particular slice of pie chart, the data should be filtered or other ay around,when I click on particular slicer filter for customer the pie chart should change. This link is not happening as I do not have common column to connect.
- NilFrequent Visitor
Hi there,
Have you got the solution?
I am having the same issue
Thank you
- asitm
Helper III
learner03 there are Paid custom visuals on Appsource that let you use measures as colours for Pie chart
Advanced Pie and Donut chart (Pie chart with full legend label)
https://appsource.microsoft.com/en-us/product/power-bi-visuals/piechartwithlegendlabelpro
1. Add the measure you want to use in 'Color by' box. (1st screenshot)
2. Click on the yellow color tray icon (top left), and use Format Style > Rules (2nd screenshot below)