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

View solution in original post

TheOpeningBat
Helper III
Helper III

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

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Top Kudoed Authors
Users online (49,618)