cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Create Graph to count items in a column

I am using a SharePoint list for my PowerApp and I need to count the number of items in each column. For Example: Column A Cat Dog Dog Cat Mouse I need a pie graph to tell me the number of cats, dogs, and mice in this column. I know I can do this in PowerBI, but the users do not have Power BI licenses. So the BI has to occur in the PowerApp.
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Hello @Anonymous, Let's say this is your collection (named "cc"): ClearCollect(cc, {a:"Cat"},{a:"Dog"},{a:"Dog"},{a:"Cat"},{a:"Mouse"}) In order to generate another collection with number of occurrences (named "col"), you can use the following formula: ClearCollect(col, DropColumns(AddColumns(GroupBy(cc, "a", "g"), "cnt", CountRows(g)), "g")) You can then assign the "col" to your PieChart control and set Labels to a and Series to cnt. Hope this helps.

View solution in original post

3 REPLIES 3
Highlighted
Microsoft
Microsoft

Hello @Anonymous, Let's say this is your collection (named "cc"): ClearCollect(cc, {a:"Cat"},{a:"Dog"},{a:"Dog"},{a:"Cat"},{a:"Mouse"}) In order to generate another collection with number of occurrences (named "col"), you can use the following formula: ClearCollect(col, DropColumns(AddColumns(GroupBy(cc, "a", "g"), "cnt", CountRows(g)), "g")) You can then assign the "col" to your PieChart control and set Labels to a and Series to cnt. Hope this helps.

View solution in original post

Highlighted
Anonymous
Not applicable

Does this strategy work when you have a sharepoint list with tens of rows? My example is small, but the SP list will grow to be very large.
Highlighted

It should. Just update the formulas with your list name and field names

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,597)