cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Microsoft Employee

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

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

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,459)