cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate III
Advocate III

How to do a group by with Choice field

I am having a choice field called Cateogry which is having values as "Sancks,Electronics, Books" etc. Now i want to group by these SharePoint list items with category and show on Pie chart as well as in Gallery. Earlier I have maitained in single line of text for cateogry field. Then i have used below formula. Since I have changed column data type from Single line of text to choice, this formula will not work. This is giving error at column name and saying, expected values are Text. how to deal with this? Is it an issue or limitation?

AddColumns(GroupBy('Purchase Orders',"Category", "Group"), "TotalQuantity", Coalesce(Sum(Group, Quantity),0))
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Advocate V
Advocate V

Re: How to do a group by with Choice field

Workaround:
Use AddColumns to introduce a new field based on the Complex field then group by the new field.

e.g. if my choice field is Category 

 

Groupby(AddColumns(DataSourceName, "NewFieldName",Category.Value),"NewFieldName","GroupName")

View solution in original post

4 REPLIES 4
Highlighted
Community Support
Community Support

Re: How to do a group by with Choice field

Hi MihirY,

 

Thanks for feedback.

 

Per my test, I found that a Choice column type is not supported in the GroupBy function.

 

Please consider to submit a request at PowerApps ideas Forum:
https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

I will help and collect it on my side.

 

Best regards,
Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Advocate III
Advocate III

Re: How to do a group by with Choice field

It is sad to know that Choice field is not supported for GroupBy function. Any workaround is there? 

One workaround i think is:

We can create one more field in the same list with single line of text and update the value with workflow as choice field value. Now use that field in groupby function inside powerapp. But this is too indirective way. What you think?

I have submitted an idea in power apps form for Choice field not supported in groupby function.

Highlighted
Advocate V
Advocate V

Re: How to do a group by with Choice field

Workaround:
Use AddColumns to introduce a new field based on the Complex field then group by the new field.

e.g. if my choice field is Category 

 

Groupby(AddColumns(DataSourceName, "NewFieldName",Category.Value),"NewFieldName","GroupName")

View solution in original post

Highlighted
Helper IV
Helper IV

Re: How to do a group by with Choice field

So far so good.

And How about to take count RiskStatus

 

GroupBy(
AddColumns(
RiskAndIssueLog,
"NewFieldName",
RiskStatus.Value
),
"NewFieldName",
"RiskName"
)

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,190)