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 / Need Help with Groupby...
Power Apps
Answered

Need Help with Groupby on Lookup columns

(0) ShareShare
ReportReport
Posted on by 145

I have a dataverse table 

PAJ1999_0-1718727379963.png

'Employee ID' column is a lookup column to the Employees table

I tried using a Groupby like this

 

ClearCollect(NewCollection,GroupBy(
    AddColumns('Employee Assets','_empid', 'Employee ID'.'Emp ID'),
    '_empid',
    'dataRecords'
))
But it gives something like this , 
PAJ1999_1-1718727505914.png
PAJ1999_2-1718727625184.png

 

everything inside 'dataRecords' is empty, It has 3 rows , but apart from unique identifier , there is nothing

Categories:
I have the same question (0)
  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @PAJ1999 

    Which field or value you want to get in your Employees Table? The data in your "dataRecords" , what do you want to get in your side?

     

    Best Regards,

    Yueyun Zhang

  • P1999 Profile Picture
    145 on at

    Due to urgency , I am tagging some people from whom I have recieved help many times, I hope they can help me 

    @MarkJarvis , @WarrenBelz ,@Amik , @mmbr1606 , @anandm08 

  • P1999 Profile Picture
    145 on at

    "Employee Assets" is a custom many to many table with columns Employee ID and Asset Number which act as lookup columns to their respective tables (i.e Employees and Assets). I am trying to use groupby by Employee ID , so that I can get all the assets respective to each employee. I am trying to make a accordian of nested galleries. For each asset type I want all the assets in the inner gallery.. I am trying to use groupby on Employee Assets table to seperate each allocation row by Employee Id and then by assets. 

  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @PAJ1999 

    Thanks for your response. In my thought , you do not need to worry about the blank value in your collection.

    For example , this is my Dataverse table:

    vyueyunmsft_0-1718766454968.png

    Gallery1 -items:

    GroupBy( AddColumns( 'Employee Assets' , '_empid' ,'Employee ID'.'Employee ID' ) ,_empid , 'dataRecords')
     
    Label -Text in Gallery1 :
    ThisItem._empid
     
    Add a nested Gallery2-items in Gallery1:
    ThisItem.dataRecords
     
    The Label in Gallery2 you can use the expression to get the value in your "Employee Asset" Table, for example:
    ThisItem.'Asset Type'
     
    The result is like this in my here:
    vyueyunmsft_2-1718766610961.png

     


    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

     

  • P1999 Profile Picture
    145 on at

    Sorry but scenario has changed a bit. 

    For the outer gallery instead of grouping by id , I am grouping it by Asset Type

    -> GroupBy('Employee Assets',pj_assettype,GroupData)
    But my GroupData is empty. 
    PAJ1999_0-1718767122723.png

    What i want is the data inside GroupData for the sub-gallery

     

     

  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @PAJ1999 

    Sure , this can also work in my thought. Do your "Asset type" is a Text type column in your Dataverse?

    In my outer Galley1 -items:

    GroupBy(  'Employee Assets' ,cr667_assettype ,GroupData )
     

    In your Nested Gallery2 -items:
    ThisItem.GroupData

     

    Label-Text in Galley2 :

    ThisItem.'Employee ID'.Name
    ThisItem.LookUpColumn.'Field In Your LookupTable'
     
    The result is like this in my side:
    vyueyunmsft_0-1718767518806.png

     

     

     


    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

     

     

     

     

     

  • P1999 Profile Picture
    145 on at

    What if I want something from my assets table. Employee ID is a lookup to the employees table. 

  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @PAJ1999 

    You can directly use this expression:

    ThisItem.'Your Field Name in your Employee Asset'
     
    For example, [ID] column is in my Employee Asset:
    vyueyunmsft_0-1718768548621.png

     

     

    If this reply can help you , you can click mark this reply as solution (Accept solution) which can help more people, thanks in advance! 

     

    Best Regards,

    Yueyun Zhang

     

     

  • P1999 Profile Picture
    145 on at

    I tried this 

    PAJ1999_0-1718769084230.pngPAJ1999_1-1718769117157.png

    But it is empty

     

  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @PAJ1999 

    Dose the [Serial Number] in your "Emploee Asset" Table? I could not see it in your screenshot.

    And what's the data type of your  [Serial Number] column?

    vyueyunmsft_0-1718774104899.png

     

     

    Best Regards,

    Yueyun Zhang

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 474

#1
Valantis Profile Picture

Valantis 474

#3
WarrenBelz Profile Picture

WarrenBelz 375 Most Valuable Professional

Last 30 days Overall leaderboard