web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to create pie char...
Power Apps
Unanswered

How to create pie chart from sharepoint list using groupby and add column

(0) ShareShare
ReportReport
Posted on by 77

Hi,

 

Here is my sharepoint list. 

 

I want to produce a pie chart that shows the total count of ACTIVE and INACTIVE in the status column of a sharepoint list.

 

I am unsure of the formula in the items property. I see some that use an ADD COLUMN and then a GROUPBY. Others do it the other way around. 

 

Here is a screenshot of my sharepoint list and powerapp page.

 

Screenshot 2023-09-16 at 11.06.30.png

 

Screenshot 2023-09-16 at 11.08.10.png

 

 

 

 

 

 

 

 

Thank you in advance. 

Categories:
I have the same question (0)
  • SpongYe Profile Picture
    5,603 Super User 2025 Season 2 on at

    Hi @lmcc 

     

    Its looks like something is wrong with your datasource. 

    I created a simple piechart and visualize the output and everything worked. 


    Can you make a screenshot of your datascource like the screen below of your pie.Items:

    SpongYe_0-1694852677151.png

     


    ------------------------------------------------------------------------------------------------------------------------------
    If I have answered your question, please mark your post as Solved. Remember, you can accept more than one post as a solution.

    If you like my response, please give it a Thumbs Up.

     

  • rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at

    hi  @lmcc welcome to the community.

     

    In your case you would like to display the pie chart based on Grouped Status Column.

     

    Steps.

    Group your data by the column for example: GroupBy(colYourData, "Status", "Statuses"), this will give you a new table with the number of unique values you have in the Status column, and the rest of the columns will be tables.

    Now you will need to get the totals and to do that you add a column to count the "Statuses" tables for each row. this will be done in your Items of the Pie Chart

     

    Consider the data source: yourDataSource

    Pie Chart Items = AddColumns(GroupBy(colYourData, "Status", "Statuses"),"Totals",CountRows(Statuses))

     

    Result:

    rubin_boer_0-1694887341230.png

     

  • lmcc Profile Picture
    77 on at

    @rubin_boer ,

     

    Hi there, 

     

    I think you're close to helping me find a solution. However, it is currently not working. Perhaps because the column in the sharepoint list is a choice column. 

     

    How would this change the formula?

     

    Thank you,

  • Verified answer
    rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at

    hi @lmcc 

     

    here you go for a choice column. get the value from the complex type and group it.

     

    AddColumns(
     GroupBy(
     AddColumns(
     OppsAgain,
     "yourNewStatus",
     Status.Value //Status is your choice column
     ),
     "yourNewStatus",
     "Statuses"
     ),
     "Totals",
     CountRows(Statuses)
    )

     

    Result

    rubin_boer_0-1694952907941.png

     

  • csuk Profile Picture
    40 on at

    Hi @rubin_boer 

    Taking this little further, if I want add total count, for example Active(6), Inactive(4), to labels on pie chart, how I can add that?

  • ecamar13 Profile Picture
    7 on at
     Hi Rubin, quick clarification
     
    "OppsAgain" what is this ? random table name ?
    "yourNewStatus" What is this ? Sharepoint list name ?
    "Status" Sharepoint column name
    "Statuses" new column table ?
    
    please clarify,thank you for your help
  • rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on at

    hi   @ecamar13 

    There are 3 steps in this formula:

    Step 1

    Add a column to the datasource (OppsAgain) and call this column "yourNewStatus" with a value Status.Value (SharePoint Column: Status)

    AddColumns(
     OppsAgain,
     "yourNewStatus",
     Status.Value //Status is your choice column
     )

    The output is having an additional column added your datasource called yourNewStatus with a value from SharePoint Status for the record assigned to it.

     

    Step 2

    Group the datasource by the column added and name the group "Statusses" 

     

    Step 3 

    Add a column to the table created by Group By, this is the new column: "Totals" 

     

    Please find the following:

    "OppsAgain" what is this ? random table name ? -

    The datasource/name of your SharePoint List
    "yourNewStatus" What is this ? Sharepoint list name ? -

    A column added to your datasource
    "Status" Sharepoint column name -

    Yes the name of the column in SharePoint
    "Statuses" new column table ?

    No this is the name of the column(s) grouped. i can see why you want to refer to it as a column as that is how it will be displayed, but technically see it as a grouped name rather column name.

     

  • ecamar13 Profile Picture
    7 on at

    sharonpoint list.JPG

    thank you for all support. I want to create a pie chart for OEM Status

    I added a column "yourNewStatus", what is the column format and how to add a value OEM Status.Value (SharePoint Column: OEM Status)

  • ecamar13 Profile Picture
    7 on at

    Please see question below.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard