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

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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 336 members 4,096 guests
Please welcome our newest community members: