Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

GroupBy Choice Column

Posted on by 302
Trying to group by choice column. Added a blank gallery to my screen.
 
GroupBy(AddColumns(Grants,"ProjectText",Project.Value),"ProjectText","Data")
Doesnt work and throws me the following error message - 
The expression was intended to add a new column named "ProjectText" to the "Grants" table, with the values coming from the "Value" property of the "Project" record. After adding this column, the expression aims to group the resulting table by the "ProjectText" column and create a nested table with the grouped data under the column name "Data".

However, there are several errors in the expression:

1. **Expected identifier name**: This error indicates that the function is expecting a valid identifier (like a variable name) but is encountering something else, likely due to the use of `StringLiteral` instead of a direct string name.

2. **The function 'AddColumns' has some invalid arguments**: This suggests that the arguments provided to the `AddColumns` function are not correctly formatted or are not valid. Specifically, the use of `StringLiteral` for the column name is incorrect.

3. **The function 'GroupBy' has some invalid arguments**: Similar to the previous error, this indicates that the arguments for the `GroupBy` function are not valid, again likely due to the incorrect use of `StringLiteral` for the column names.

To fix these errors, the `StringLiteral` functions should be replaced with direct string literals for the column names.
 
Categories:
  • WarrenBelz Profile Picture
    WarrenBelz 143,246 on at
    GroupBy Choice Column
    You would filter (example below) by the selected record in the first gallery
    GroupBy(
       AddColumns(
          Filter(
             Grants,
             Project.Value = Gallery1.Selected.Project.Value
          ),
          ProjectText,
          Project.Value
       ),
       ProjectText,
       Data
    )
     
  • honganhuynh1 Profile Picture
    honganhuynh1 302 on at
    GroupBy Choice Column
    Thank you Warren! That worked. I have a sharepoint list grouped by the choice column Project. So that's why i'm grouping it on the first screen.

    On selection of a project how do have gallery2 show the tasks associated with the selected project from gallery1?
  • Verified answer
    WarrenBelz Profile Picture
    WarrenBelz 143,246 on at
    GroupBy Choice Column
    You do not need quotes around the parameters
    GroupBy(
       AddColumns(
          Grants,
          ProjectText,
          Project.Value
       ),
       ProjectText,
       Data
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,246

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,884

Leaderboard