web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Function GroupBy has s...
Power Apps
Answered

Function GroupBy has some invalid arguments

(0) ShareShare
ReportReport
Posted on by 377

Hi

I am trying to display a pie chart by using this blog.

https://blog.atwork.at/post/Tips-for-PowerApps-8-Group-and-chart

 

 

I've a table ProjectThamesRequests and it has a lookup column called "Firm" which looks up to Firm.Title

I want to group by firm and display the number of requests per firm.

 

I try to do this ...

 

ClearCollect(RequestsByFirm,
AddColumns(
GroupBy(ProjectThamesRequests, "Firm","Rows"),
"RowCount",
CountRows(Rows)
)
);

 

but get the error "Function GroupBy has some invalid arguments"

 

Thanks

P

Categories:
I have the same question (0)
  • TheRobRush Profile Picture
    11,128 Moderator on at

    Tested out on my side just to make sure, but the syntax is right. Maybe hover over each part of your groupby until it gives you the little hovericon that tells you this part is wrong like this

    TheRobRush_0-1671211796674.png

     

  • pmwhelan Profile Picture
    377 on at

    Thanks

    It says "Expected a text, numeric, boolean or datetime"

    It must not like a Lookup column?

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Lookup column will probably need a modifier on it something like ColumnName.Selected.Title  or Concat(ColumnName, Title, ", "). You might try narrowing that down by tossing in a quick glalery, setting it to your datasource, and make a label control in it, and start putting in variations of modifiers for that specific column until you get one that returns a string. I'd set up a test on my side but none of the splists I have setup right now use lookup columns

  • pmwhelan Profile Picture
    377 on at

    Thanks but I don't really follow.

  • TheRobRush Profile Picture
    11,128 Moderator on at

    A lookup column is a table. Kind of like if you wanted to reference a value in the title col,umn of a splist you would have to type SPList.Title, not just splist.

     

    Since a lookup table is a table you have to reference the column you are wanting to look at inside of it the same way.

  • pmwhelan Profile Picture
    377 on at

    I try this ...

     

    ClearCollect(RequestsByFirm,
    AddColumns(
    //GroupBy(ProjectThamesRequests, "Firm","Rows"),
    GroupBy(
    AddColumns(
    ProjectThamesRequests,
    "Firm", 'Firm'.Value
    ),
    "Firm",
    "Rows"
    )
    "RowCount",
    CountRows(Rows)
    )
    );

     

    groupbyerror.png
  • TheRobRush Profile Picture
    11,128 Moderator on at

    Check out this post, and more importantly the solution provided by @RandyHayes you will see he has added the modifier .Value to the end of the lookup field used in the add columns formula

  • pmwhelan Profile Picture
    377 on at

    Yes I have done that.

    It's in my code above.

    Thanks

  • WarrenBelz Profile Picture
    154,795 Most Valuable Professional on at

    @pmwhelan ,

    Just helping @TheRobRush who has done the hard work here - the only issue with your code is that you cannot add a field name that already exists - the RenameColumns part is only necessary if you want Firm as the field name resolved

    ClearCollect(
     RequestsByFirm,
     RenameColumns(
     AddColumns(
     GroupBy(
     AddColumns(
     ProjectThamesRequests,
     "MyFirm", 
     Firm.Value
     ),
     "MyFirm",
     "Rows"
     ),
     "RowCount",
     CountRows(Rows)
     ),
     "MyFirm",
     "Firm"
     )
    );

     

  • pmwhelan Profile Picture
    377 on at

    Thanks but the function RenameColumns has some invalid arguments.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard