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 / Collection with GroupB...
Power Apps
Suggested Answer

Collection with GroupBy, AddColumn and LookUp Columns

(1) ShareShare
ReportReport
Posted on by 126
Hello
 
how can I use GroupBy with lookup columns in the table please?
 
I have a joint table OperaceVNKN with columns Operace and VNKN (Operace is lookup column where it takes column Nazev from table Operace, VNKN is lookup column Seznam in table VNKN)
 
Tried this:
 
ClearCollect(
groupOpe;
AddColumns(
GroupBy(
OperaceVNKN;
Operace;
VNKN
);
skupOperace;
CountIf(OperaceVNKN;true)
)
)
 
Can anyone see a problem? Thanks
Categories:
I have the same question (0)
  • Suggested answer
    Jon Unzueta Profile Picture
    1,834 Super User 2026 Season 1 on at
     

    Thanks for sharing your formula and context! You're close, but there are a few things to clarify when using GroupBy with lookup columns in Power Apps.

     Problem Breakdown

    You're trying to group a collection (OperaceVNKN) by two lookup columns: Operace and VNKN. However, GroupBy in Power Apps works best with text or primitive values, not complex records like lookup fields (which are actually records with nested properties).

    Solution Approach

    To group by the display values of the lookup columns (e.g., Operace.Nazev and VNKN.Seznam), you need to extract those values first using AddColumns, then group by the new columns.


    Suggested Formula

    ClearCollect(

        groupOpe,

        AddColumns(

            GroupBy(

                AddColumns(

                    OperaceVNKN,

                    OperaceNazev, Operace.Nazev,

                    VNKNSeznam, VNKN.Seznam

                ),

                "OperaceNazev",

                "VNKNSeznam"

            ),

            "skupOperace",

            CountRows(ThisRecord[@AllItems])

        )

    )

    🏷️ Tag me if you have any further questions or if the issue persists.
    ✅ Click "Accept as Solution" if my post helped resolve your issue—it helps others facing similar problems.
    ❤️ Give it a Like if you found the approach useful in any way.

     

     
  • Suggested answer
    Jon Unzueta Profile Picture
    1,834 Super User 2026 Season 1 on at
     

    Thanks for sharing your formula and context! You're close, but there are a few things to clarify when using GroupBy with lookup columns in Power Apps.

     Problem Breakdown

    You're trying to group a collection (OperaceVNKN) by two lookup columns: Operace and VNKN. However, GroupBy in Power Apps works best with text or primitive values, not complex records like lookup fields (which are actually records with nested properties).

    Solution Approach

    To group by the display values of the lookup columns (e.g., Operace.Nazev and VNKN.Seznam), you need to extract those values first using AddColumns, then group by the new columns.


    Suggested Formula

    ClearCollect(

        groupOpe,

        AddColumns(

            GroupBy(

                AddColumns(

                    OperaceVNKN,

                    OperaceNazev, Operace.Nazev,

                    VNKNSeznam, VNKN.Seznam

                ),

                "OperaceNazev",

                "VNKNSeznam"

            ),

            "skupOperace",

            CountRows(ThisRecord[@AllItems])

        )

    )

    🏷️ Tag me if you have any further questions or if the issue persists.
    ✅ Click "Accept as Solution" if my post helped resolve your issue—it helps others facing similar problems.
    ❤️ Give it a Like if you found the approach useful in any way.

     

     

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 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard