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

Using Choice Column in PieCharts

I have an SP list called hazards and a choice column called Cause. Inside the choice column I have examples called Slips, Trips, Falls etc. I'd like to create a PieChart in my PowerApp to count how many of each cause I have in my SP list.

 

I have now idea where to start but during my search I came accross the GroupBy and AddColumns formula.

 

This is what I have so far

 

GroupBy(AddColumns(Hazards,"Causes",Cause.Value),"Cause","GroupData"),"CountByCause",CountRows(GroupData))

 

Can someone point me in the right direction please

 

Thanks 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @KevinSquirrels ,

Do you want to display the count of each cause from your SP List within the Pie Chart control?

 

Based on the formula you provided, I think there is something wrong with it. I have made a test on my side, please take a try with the following workaround:

Set the Items property of the Pie Chart control to following:

AddColumns(
GroupBy(
AddColumns(
Hazards,
"CauseValue",
Cause.Value
),
"CauseValue",
"GroupData"
),
"Count",
CountRows(GroupData)
)

then within Pie Chart control, set the Labels property to CauseValue column, Series property to Count column.

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xida-msft
Community Support
Community Support

Hi @KevinSquirrels ,

Do you want to display the count of each cause from your SP List within the Pie Chart control?

 

Based on the formula you provided, I think there is something wrong with it. I have made a test on my side, please take a try with the following workaround:

Set the Items property of the Pie Chart control to following:

AddColumns(
GroupBy(
AddColumns(
Hazards,
"CauseValue",
Cause.Value
),
"CauseValue",
"GroupData"
),
"Count",
CountRows(GroupData)
)

then within Pie Chart control, set the Labels property to CauseValue column, Series property to Count column.

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Fantastic thank you. This worked perfectly.

 

One more cheeky question if I may. Can I filter by date picker. I have a column in the SP list called "Date Raised". I'd like to add a date picker on ther Pie Chart Screen. Then the user can select a date and the pie chart will show all SP rows added since that date and display the cause pie chart accordingly.

 

Hope that makes sence. 

 

Thanks again

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,086)