Skip to main content

Notifications

Community site session details

Community site session details

Session Id : etq/5PsIML9eSquEBn5Qaj
Power Apps - Building Power Apps
Answered

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

Like (0) ShareShare
ReportReport
Posted on 16 Sep 2023 03:09:47 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. 

  • ecamar13 Profile Picture
    7 on 18 Mar 2024 at 23:55:59
    Re: How to create pie chart from sharepoint list using groupby and add column

    Please see question below.

  • ecamar13 Profile Picture
    7 on 18 Mar 2024 at 15:29:54
    Re: How to create pie chart from sharepoint list using groupby and add column

    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)

  • rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on 16 Mar 2024 at 07:57:15
    Re: How to create pie chart from sharepoint list using groupby and add column

    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 11 Mar 2024 at 15:00:47
    Re: How to create pie chart from sharepoint list using groupby and add column
     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
  • csuk Profile Picture
    40 on 24 Oct 2023 at 19:54:39
    Re: How to create pie chart from sharepoint list using groupby and add column

    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?

  • Verified answer
    rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on 17 Sep 2023 at 12:13:57
    Re: How to create pie chart from sharepoint list using groupby and add column

    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

     

  • lmcc Profile Picture
    77 on 17 Sep 2023 at 04:20:36
    Re: How to create pie chart from sharepoint list using groupby and add column

    @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,

  • rubin_boer Profile Picture
    4,841 Super User 2024 Season 1 on 16 Sep 2023 at 18:03:43
    Re: How to create pie chart from sharepoint list using groupby and add column

    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

     

  • SpongYe Profile Picture
    5,580 Super User 2025 Season 1 on 16 Sep 2023 at 08:25:40
    Re: How to create pie chart from sharepoint list using groupby and add column

    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.

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,999 Most Valuable Professional

Leaderboard