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
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

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

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,204)