cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JamesTarver
Frequent Visitor

Pie Chart from a gallery/table

Hi, 

 

Hoping somebody will help me with this. 

 

I have a SharePoint list with a 'log' of potential 'route causes' of faults. Effectively somebody can submit an entry to the list identifying a route cause to a problem (this is filtered via a form on the app), so what you end up with is a list highlighting the most common route cause of the fault. From here I want to produce a pie chart so that when you get a certain fault, you can select it from a drop down and it will show you the most likely route cause of that fault - based off the number of entries for certain route causes. 

For example if there are 4 entries, 3 of them are 'wire break', 1 of them is 'short circuit', then the pie chart would display 3/4 is a 'wire break', 1/4 is a 'short circuit'. 

 

I was planning on filtering a table or gallery based on drop downs, and then tying the pie chart to the gallery, but i can't figure out how to get distinct values/a count of how many of each route cause there is. The filtered table looks like this: 

JamesTarver_0-1663776078708.png

So i would want the pie chart to show that 2/3 of the time "Mechanical Backlash" is the route cause, and 1/3 of the time "Regulator Card" is the route cause. 

 

Ideally i wanted a few text fields showing the exact percentages of each, but this would do for now! Please can someone point me in the best direction! Thank you in advance! 


James

 

1 ACCEPTED SOLUTION

Accepted Solutions
One
Super User
Super User

yeah the pie charts are a little weird in powerapps, they don't account for duplicates in the list. if you are just trying to get the count then you can use CountRows as follows:

CountRows(Filter(YourCollectionName,YourCollumnName = "ValueToFilterBy"))

 you can replace "ValueToFilterBy" with your dropdown.selected.value, then you will get the count of the value selected, you can apply more than one drop down as well so you can filter by fault code and root cause. otherwise you will need a normalized collection without redundancy to display properly in a pie chart.

View solution in original post

5 REPLIES 5
One
Super User
Super User

hi @JamesTarver,

you are going to want to use a collection for your pie chart. the collection will make it easier for you to count the number of records, specify which column you want to pull data from, etc. you can still use the gallery/ dropdown you visualize and filter the data. just make sure to ClearCollect when you apply a filter to make sure your collection stays up to date with the data you want to see. For further details please click Here.

 

------------------------------------------------------------------------------------------------------------------------------
Please click "Accept as Solution" if this post answered your question so that it is helpful for people having similar questions. If you found this post helpful smack that Thumbs up button! Thanks!

Hi @One , 

Thanks for the reply! 

I have tried this but it just seems to return the same problem, I can get the pie chart to display the results, but it will not total them up. I end up with the pie chart just displaying 1/3, 1/3, 1/3, instead of 2/3, 1/3. 

 

Any ideas? Really frustrating, I just want it to sum the entries that have been filtered into the table. 😩 

One
Super User
Super User

yeah the pie charts are a little weird in powerapps, they don't account for duplicates in the list. if you are just trying to get the count then you can use CountRows as follows:

CountRows(Filter(YourCollectionName,YourCollumnName = "ValueToFilterBy"))

 you can replace "ValueToFilterBy" with your dropdown.selected.value, then you will get the count of the value selected, you can apply more than one drop down as well so you can filter by fault code and root cause. otherwise you will need a normalized collection without redundancy to display properly in a pie chart.

Thanks for this, I think I'm going to be able to make something work. I'll let you know how I get on, Cheers!

I ended up just creating a new page and then calculating the percentage of the collection with the specific name. So, not a pie chart, but very close and does the job of what I wanted to display. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,149)