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 🙂
Solved! Go to Solution.
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,
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,
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
User | Count |
---|---|
196 | |
124 | |
87 | |
49 | |
42 |
User | Count |
---|---|
284 | |
163 | |
138 | |
75 | |
72 |