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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Group by function erro...
Power Apps
Unanswered

Group by function error - cannot be blank

(0) ShareShare
ReportReport
Posted on by 24

Hi - I am a beginner with Power Apps. I would appreciate any insights on the issue -

 

The first argument to the Group By Function cannot be blank. would it be because OfficeManagers having no values. OfficeManagers is declared under global variables

 

SortByColumns(
GroupBy(
AddColumns(
Filter(
OfficeManagers,
Len(EMAIL) > 0
),
"DisplayText",
FORMATTED_FULL_NAME & " (" & Left(
EMAIL,
Find(
"@",
EMAIL
) - 1
) & ")"
),
"DisplayText",
"OFCMGR_EMP_ID",
"EMAIL",
"grouping"
),
"DisplayText",
SortOrder.Ascending
)
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    Hi @ssg_fc ,

    You should be using GroupBy on a List or Collection, not a Variable.

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • ssg_fc Profile Picture
    24 on at

    @WarrenBelz  Thanks for your response. OfficeManagers is a table but i see it under Global Variables as table. I am not sure which is the first argument in the Group by that is causing the issue. just wondering, If there is a way to put some default value there as first argument if  blank.

  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    @ssg_fc ,

    I have never attempted to use GroupBy on a Variable - I suspect this would work on a Collection - GroupBy will work with blank values - they simply have a group of their own.

    SortByColumns(
     GroupBy(
     AddColumns(
     Filter(
     OfficeManagers,
     Len(EMAIL) > 0
     ),
     "DisplayText",
     FORMATTED_FULL_NAME & 
     " (" & 
     First(
     Split(
     EMAIL,
     "@"
     )
     ).Value & 
     ")"
     ),
     "DisplayText",
     "OFCMGR_EMP_ID",
     "EMAIL",
     "grouping"
     ),
     "DisplayText",
     SortOrder.Ascending
    )

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • ssg_fc Profile Picture
    24 on at

    @WarrenBelz - This is what I am seeing SalesManagers is a table.  (I used OfficeManagers earlier, but similar one) 

    I tried the above and it still gave me 'Group by error.  The first argument cannot be blank. Basically the App works when user selects some values. Is it possible to suppress this group by error when the combo box is blank?

    ssg_fc_0-1690650011579.png

     

  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    @ssg_fc ,
    You could try

    If(
     !IsEmpty(OfficeManagers),
     SortByColumns(
     GroupBy(
     AddColumns(
     Filter(
     OfficeManagers,
     Len(EMAIL) > 0
     ),
     "DisplayText",
     FORMATTED_FULL_NAME & 
     " (" & 
     First(
     Split(
     EMAIL,
     "@"
     )
     ).Value & 
     ")"
     ),
     "DisplayText",
     "OFCMGR_EMP_ID",
     "EMAIL",
     "grouping"
     ),
     "DisplayText",
     )
    )

     

    Please click Accept as solution 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 Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • ssg_fc Profile Picture
    24 on at

    @WarrenBelz I am still getting the same error. Is there a way I can suppress this error at the beginning? I really appreciate your time.

    ssg_fc_0-1690694201194.png

     

  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at

    @ssg_fc ,

    I can only suggest you ensure that the Variable always has content in the structure expected by the GroupBy formula.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard