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

Pie Chart

Hi guys, I am currently building an analytical feature within my app where I have a pie chart displaying the percentages of each item within the column as seen below.

Kane2_0-1670206342164.png

However, I want to filter the pie chart above by only showing a specific item percentage and labelling the rest as "others", is there a way to do so or how can I edit my code below? Thanks in advance!

Kane2_1-1670206409701.png

@WarrenBelz @RandyHayes @Drrickryp 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Kane2 ,

 

Please try:

 

AddColumns(
AddColumns(
GroupBy(
AddColumns(HiddenMasterGallery.AllItems,"NewLabel",If(HiddenCategory="specific item","specific item","Others")),
"NewLabel",
"_cat"
),
"_total",CountRows(HiddenMasterGallery.AllItems),
"_number",CountRows(_cat)
),
"_percentage",
Text((_number/_total)*100,"0%")

)

 

 

Best Regards,

Bof

View solution in original post

6 REPLIES 6
v-bofeng-msft
Community Support
Community Support

Hi @Kane2 ,

 

Please try:

AddColumns(
AddColumns(
GroupBy(
xxxx
),
),
"_percentage",
If(HiddenCategory="specific item",Text((_number/_total)*100,"0%"),"others")
)

 

Best Regards,

Bof

Hi I did as you said, it worked at seen below. However, is there a way to merge all of the "others" section of the pie chart into 1 section? Thanks Again 🙂

Kane2_0-1670207423783.png

 

Hi @Kane2 ,

 

Please try:

 

AddColumns(
AddColumns(
GroupBy(
AddColumns(HiddenMasterGallery.AllItems,"NewLabel",If(HiddenCategory="specific item","specific item","Others")),
"NewLabel",
"_cat"
),
"_total",CountRows(HiddenMasterGallery.AllItems),
"_number",CountRows(_cat)
),
"_percentage",
If(NewLabel="specific item",Text((_number/_total)*100,"0%"),"others")
)

 

Best Regards,
Bof

Hello again, the image below shows my current chart. Is it possible to change both the labels to percentages while having the legend as "Specific Item" & "Others"?

Kane2_0-1670209127450.png

 

Hi @Kane2 ,

 

Please try:

 

AddColumns(
AddColumns(
GroupBy(
AddColumns(HiddenMasterGallery.AllItems,"NewLabel",If(HiddenCategory="specific item","specific item","Others")),
"NewLabel",
"_cat"
),
"_total",CountRows(HiddenMasterGallery.AllItems),
"_number",CountRows(_cat)
),
"_percentage",
Text((_number/_total)*100,"0%")

)

 

 

Best Regards,

Bof

Thank you so much! it works perfectly now:)))

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,829)