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

Re: Create Graph to count items in a column

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

Re: Create Graph to count items in a column

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

Re: Create Graph to count items in a column

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
Microsoft
Microsoft

Re: Create Graph to count items in a column

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

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,730)