cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Z_Lukowski
Resolver I
Resolver I

Groupby by a Lookup field - giving error "Expected a text, numeric, boolean, or date/time value - even when I use Text() in my lookup

Hello Power Users,

I have a Gallery in which I have a Lookup column ("DogColumn"),

ThisItem.'Dog'.'DogName'

Where 'Dog' is a Lookup column in my Table Shelter(which is source of my Gallery btw)  to Table Dogs, and 'DogName' is primary column there

I want to Groupby my items by 'DogName'

 

So I've created:

Groupby(Gallery_Dogs, "DogColumn", "AnyNameWIlldo") - which should group my records based on DogName

 

but I get error:

"Expected a text, numeric, boolean, or date/time value"

When Ive changed "DogColumn" to Text(ThisItem.'Dog'.'DogName') it did not help, my datatype is text and yet it expects text value in error message:

Z_Lukowski_0-1612971663625.png

 

Of course my Gallery is displaying properly and all the dog names are there, they are correct, based on Lookup field, so the issue is not there.

 

@RandyHayes  - created my new topic following your advice,

 

Would appreciate any kind of help, and wish you good day to all kind Power Users out there 🙂

 

Regards,

Zbigniew

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Z_Lukowski 

Thanks for posting a new thread...it will get more attention.

 

You will not be able to group by a lookup column without a couple steps.

I am assuming (since you mentioned Gallery_Dogs in your formula sample) that you want to Group By the items in your Gallery

 

Your formula should be as follows:

GroupBy(
    AddColumns(
        Gallery_Dogs.AllItems,
        "_dogName", Dog.DogName
    ),
    "_dogName",
    "records"
)
    

This will return a table of grouped dog names and their associated records.

 

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

5 REPLIES 5
RandyHayes
Super User
Super User

@Z_Lukowski 

Thanks for posting a new thread...it will get more attention.

 

You will not be able to group by a lookup column without a couple steps.

I am assuming (since you mentioned Gallery_Dogs in your formula sample) that you want to Group By the items in your Gallery

 

Your formula should be as follows:

GroupBy(
    AddColumns(
        Gallery_Dogs.AllItems,
        "_dogName", Dog.DogName
    ),
    "_dogName",
    "records"
)
    

This will return a table of grouped dog names and their associated records.

 

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

You @RandyHayes are truly my saviour, big online hug 🤗  If you ever in Warsaw leave me a message on forum, and I owe you a round,drink, smoothie or whatever you like. 

RandyHayes
Super User
Super User

@Z_Lukowski 

Happy to help!!  I will certainly keep your invite in mind should I be in the area 😁

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes And what If I would like to count those dog names based on my groupby and Filterout results with Records <>2, example on screenshot, is this even possible?

Z_Lukowski_0-1613049984911.png

 

Best Regards

Zbigniew

 

RandyHayes
Super User
Super User

@Z_Lukowski 

Sure thing, you can add more columns to contain that information:

AddColumns(
    GroupBy(
        AddColumns(
            Gallery_Dogs.AllItems,
            "_dogName", Dog.DogName
        ),
        "_dogName",
        "records"
    ),
    "_dogCount", CountRows(records)
)

 

_dogCount will have the count of the dog names of that group. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (2,008)