cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TheOpeningBat
Helper III
Helper III

Show count of records in pie chart based on choice column

Hi,

 

I have a sharepoint list as below:

Ref#   Stage            Description

Ref1   In Progress    Some description

Ref2   Completed    Some description

Ref3   On-hold        Some description

and so on

 

Here, Stage is a choice column

 

I want to create a pie chart as below:

 

TheOpeningBat_0-1617442662731.png

So basically in the pie chart i want to show the count of Stages
Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @TheOpeningBat ,

The formula provided by @rubin_boer already including the count column. So you just need to set the Legend control to use the count result.

To make it clearly, you can keep the result into a collection:

ClearCollect(varchart,AddColumns(GroupBy(MyCollection,"NewFieldForStage","Stages"),"Total",CountRows(Stages)))

Then set the PieChart control to:

varchart.Total

Set Legend control to:

varchart.NewFieldForStage

v-albai-msft_0-1617699492718.png

 

Best regards,

Allen

View solution in original post

4 REPLIES 4
rubin_boer
Super User
Super User

Hi @TheOpeningBat add a collection for your SharePoint List. Add a barchart and Set its tems = AddColumns(GroupBy(YourCollection,"Stage","Stages"),"Total",CountRows(Stages)).

 

It will give you the desired result

 
TheOpeningBat
Helper III
Helper III

Hi @rubin_boer,

Tried as below:

 

Created a collection on the onVisible event of the screen:

ClearCollect(MyCollection, AddColumns(MySPList, "NewFieldForStage", Stage.Value));

Created a pie chart & on the Items property added the below:
AddColumns(GroupBy(MyCollection,"NewFieldForStage","Stages"),"Total",CountRows(Stages))

However - I am not able to get how to show the Total count of In progress, Completed & On-hold items in the Labels.

 

I want the Legend as In progress, Completed & On-hold & Labels in the pie chart to show the total count of those items but it is showing the stages - In progress, Completed & On-hold & not the total count.

 

Am I missing something here. Please help.

 

Hi @TheOpeningBat ,

The formula provided by @rubin_boer already including the count column. So you just need to set the Legend control to use the count result.

To make it clearly, you can keep the result into a collection:

ClearCollect(varchart,AddColumns(GroupBy(MyCollection,"NewFieldForStage","Stages"),"Total",CountRows(Stages)))

Then set the PieChart control to:

varchart.Total

Set Legend control to:

varchart.NewFieldForStage

v-albai-msft_0-1617699492718.png

 

Best regards,

Allen

TheOpeningBat
Helper III
Helper III

Thanks a lot @v-albai-msft & @rubin_boer. Working fine now.

Helpful resources

Announcements
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (2,859)