cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Adding Count to Pie Chart Labels

I'm adding a Pie Chart that displays the current status of entries in a SharePoint list as they move through a process. I would just like to be able to add the value of the CountRows into the labels so that it reads "[Status]: [CountRows(Status)]" if that makes sense? 

For example, if I had 3 possible choices for Status, Phase 1, Phase 2, Phase 3 and I had 20 items in Phase 1, 40 items in Phase 2, and 60 items in Phase 3, I would want the legend to read:


Phase 1: 20

Phase 2: 40

Phase 3: 60

 

I am using the following code in the Items section for my Pie Chart.:

 

DropColumns(AddColumns(GroupBy(AddColumns('SP_List', "Txt_Status", Status.Value), "Txt_Status", "Grouped"), "Counts", Value(CountRows(Grouped))), "Grouped")

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

So... I answered my own question after some playing around. I set up a collection and filled the data through the OnVisible property. 

I basically did the following two lines of code for every phase. Then I selected the two fields for the labels and series. 

UpdateContext({tempCounter: CountRows(Filter('SharePoint List', Phase.Value = "Phase 1"))});
Collect(phaseCollection, {RowLabel: "Phase 1: " & Text(tempCounter), RowCount: tempCounter});

View solution in original post

5 REPLIES 5
Highlighted
Resolver III
Resolver III

hi there

 

what does the data in the SP list look like?

 

Are you looking for something like this?

rubin_boer_0-1601664454283.png

 

Highlighted

Really, I want to include the count of each phase in the label as below. I've seen some solutions in how to do this using a gallery, but then that one be linked to the right color of the chart for the legend. 

jmparty_0-1601665461645.png

 

Highlighted

So... I answered my own question after some playing around. I set up a collection and filled the data through the OnVisible property. 

I basically did the following two lines of code for every phase. Then I selected the two fields for the labels and series. 

UpdateContext({tempCounter: CountRows(Filter('SharePoint List', Phase.Value = "Phase 1"))});
Collect(phaseCollection, {RowLabel: "Phase 1: " & Text(tempCounter), RowCount: tempCounter});

View solution in original post

Highlighted

Im looking something like that.

 

How can I do that?

 

@rubin_boer 

Highlighted

This is what I did to solve my problem (original poster):

 

I set up a collection and filled the data through the OnVisible property. 

I copied the following two lines of code for every phase. 

UpdateContext({tempCounter: CountRows(Filter('SharePoint List', Phase.Value = "Phase 1"))});
Collect(phaseCollection, {RowLabel: "Phase 1: " & Text(tempCounter), RowCount: tempCounter});

 

Then I populated the pie chart using the two fields for the labels and series. 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,109)