Forum Discussion
PIE Chart - Counting Values
Good Day!
As seen in the pics below I want to count how 'Event Descriptions' there are and put them in a Pie Chart in Power BI. I have leanrt how to do it in Excel but with all my internet searching I'm failing to find anything to help me. Anyone got any ideas?
I just want the pie chart to refect how many times each gas alarm is seen.
Excel Sheet with Data and Pie ChartPortion of my POwer BI data
Hi Gasdetect40
If you go to canvas view in Power BI Desktop, select a Pie Chart. Drag the Event Description column into the Legend space and then drag the Event Description into the Value space. Make sure to click the down arrow on the Event Description in the Values section and click Count.
Hope this helps.
Theo 🙂
- Anonymous4 years ago
Hi Gasdetect40 ,
Agree with TheoC to simply use the summarize type of "Count" for Event type:
Or you could create a measure to calculate the count of each description:
Measure = CALCULATE( COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Event description]))Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. - Anonymous4 years ago
Hi TheoC ,
Of course! as you mentioned, COUNTROWS ( 'Table' ) is enough for this simple case. I'm just used to “fullfill” the measure in case there are some more complex situations. Sorry for the redundant operation😜
Best Regards,
Eyelyn Qin Hi @Gasdetect40
If you go to canvas view in Power BI Desktop, select a Pie Chart. Drag the Event Description column into the Legend space and then drag the Event Description into the Value space. Make sure to click the down arrow on the Event Description in the Values section and click Count.
Hope this helps.
Theo 🙂
17 Replies
- TheoCCommunity Champion
Hi Gasdetect40
If you go to canvas view in Power BI Desktop, select a Pie Chart. Drag the Event Description column into the Legend space and then drag the Event Description into the Value space. Make sure to click the down arrow on the Event Description in the Values section and click Count.
Hope this helps.
Theo 🙂
- hgillinNew Member
Excellent solution. Thanks
- AnonymousNot applicable
Hi TheoC ,
Of course! as you mentioned, COUNTROWS ( 'Table' ) is enough for this simple case. I'm just used to “fullfill” the measure in case there are some more complex situations. Sorry for the redundant operation😜
Best Regards,
Eyelyn Qin- TheoCCommunity Champion
Hi Anonymous
Haha... I agree, measures are always fun to use and it makes sense in terms of more complex situations arising. And your post was not redundant in any way, I just wanted to better understand the driver!!
Thanks heaps for explaining and all the best!
Theo 🙂
- AnonymousNot applicable
Hi Gasdetect40 ,
Agree with TheoC to simply use the summarize type of "Count" for Event type:
Or you could create a measure to calculate the count of each description:
Measure = CALCULATE( COUNTROWS('Table'),ALLEXCEPT('Table','Table'[Event description]))Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- TheoCCommunity Champion
Hi Anonymous
Thanks for the kind comments.
With regard to your post, what has driven you to create a measure of that nature given that the Legend in the Pie Chart still needs to broken down using the Event Description field? Would this not create unnecessary duplication / overkill?
Thanks and look forward to better understanding the approach! I would have thought, given that pie charts must be disected with something (i.e. the Event Description), if any measure was to be used, it would have just been "COUNTROWS ( 'Table' )" rather than integrating CALCULATE and ALLEXCEPT.
All the best!
Theo 🙂
- TheoCCommunity Champion
Hi @Gasdetect40
If you go to canvas view in Power BI Desktop, select a Pie Chart. Drag the Event Description column into the Legend space and then drag the Event Description into the Value space. Make sure to click the down arrow on the Event Description in the Values section and click Count.
Hope this helps.
Theo 🙂
- Gasdetect40Frequent Visitor
Sorry everyone, I will get better at the 'reply as a solition' task. Thank you for all your help!
- Whibley92Helper II
How would you do this for multiple columns? The columns were originally words in one cell but I split by delimiter and now have 4 columns. Some are blank as there was a 4 word choice limit in the question form.
- TheoCCommunity Champion
Hi Whibley92
If you used "Split by Delimiter" then you are in Power Query. With that in mind, you can use Power Query to "Pivot / Unpivot" the data you have and create one single column with multiple categories in that New Column.
- Select the four columns by holding down the Ctrl button and click on each column
- Then use your mouse and right-click one of the selected column names.
- Click the "Unpivot" option.
Now, go back to Canvas View in Power BI Desktop (i.e. out of Power Query). Use the New Column as the category field, and you should be able to get the outcome you want.
Hope this helps.
Theo 🙂
- Whibley92Helper II
Thanks yes I was worried about how it would affect other columns in the table, so I created a copy and then practiced on that.
Can you Pivot/Unpivot on selected columns within a large table?
- KhushboobaraiHelper IVHii, Can you help me with the pie chart or donut, as in my pie have only 6 category which im showing as data value and percentage of total and even tried with showing label separately and only % over the slices. The problem with pie and donut is when im filtering my report with anything it is getting blank or showing half of the work or Information as in the ss , like when i made with 0 padidng and all all info of visual showing properly but when i trying fitering more than 2 time its getting blank showing only pie chart with those slices colors