cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
marsyazahid72
Helper I
Helper I

formula to create percentage in pie chart?

Hello everyone!

 

I really, really need help with a formula to create percentages in a pie chart.

 

1. I have a SharePoint list.

 

image.png

 

2. This SharePoint list had been used into gallery ( GalleryEdit1 ) where I filtered based on the specific user ( User().email ).

 

marsyazahid72_0-1616285047631.png

 

3. I really, really need to create a pie chart in Power Apps that can calculate the percentage of each column in pie chart as below image (which I draw by myself for the expected result) where the percentage can be increased/decreased if any changes in the gallery.

 

marsyazahid72_1-1616286238923.png

4. The calculation that I can figure out is this

each column : FPoints of SRC / total FPoints *100%
total FPoints : 
(FPoints of SRC + FPoints of Clubs/Society + FPoints of Special Events + FPoints of Ad-Hoc Teams)

 

Highly appreciated anyone's attention and guidance.🤗

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@marsyazahid72 

Consider the following:

Change your Items property of the Pie Chart to -

AddColumns(
    AddColumns(
        GroupBy(
            GalleryEdit_1.AllItems,
            "EC_PA_Cri1",
            "_recs"
        ),
        "_total", CountRows(GalleryEdit_1.AllItems),
        "_recTotal", CountRows(_recs)
    ),
    "_label", EC_PA_Cri1 & " : " & Text((_recTotal/_total)*100, "%0")
)

Set the Series on your PieChart to  _recTotal

Set the Labels on your PieChart to _label

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

2 REPLIES 2
marsyazahid72
Helper I
Helper I

I also had tried to use my friend's code where she gets the result as below image but when I apply to my case, unfortunately, it did not works😢.

The pie chart she had createdThe pie chart she had created

her code for the pie charther code for the pie chart

Anyone could help me?😢

RandyHayes
Super User III
Super User III

@marsyazahid72 

Consider the following:

Change your Items property of the Pie Chart to -

AddColumns(
    AddColumns(
        GroupBy(
            GalleryEdit_1.AllItems,
            "EC_PA_Cri1",
            "_recs"
        ),
        "_total", CountRows(GalleryEdit_1.AllItems),
        "_recTotal", CountRows(_recs)
    ),
    "_label", EC_PA_Cri1 & " : " & Text((_recTotal/_total)*100, "%0")
)

Set the Series on your PieChart to  _recTotal

Set the Labels on your PieChart to _label

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

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.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

Top Solution Authors
Top Kudoed Authors
Users online (63,234)