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 / Combine two formulas i...
Power Apps
Unanswered

Combine two formulas in a gallery

(0) ShareShare
ReportReport
Posted on by 9

Hi all,

 

I have been developing some apps but now I having an issue in a gallery that I cannot solve

 

First I filtered a gallery related to table 1 by using a Dropdown, the formula works

 

If(Dropdown1.Selected.Result = "All";Table1;Filter(Table1;Column1= Dropdown1.Selected.Result))

 

Then I was asked to add a column from table 2 to the gallery, this formula also works

 

AddColumns(Table1;"ColumnXY";LookUp(Table2;ColumnX =Table1[@ColumnX];ColumnY))

 

Both formulas work perfectly separately however, now I want to put it together that I have the added column in the gallery but also I can filter it by using the dropdown

 

Does someone know how to combine both formulas?

 

Many thanks in advance

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @dbatllevz  

     

     

    With({tbl: AddColumns(
     Table1;"ColumnXY";LookUp(
     Table2;ColumnX =Table1[@ColumnX];ColumnY
     )
     )}
     );
    If(
     Dropdown1.Selected.Result = "All" ; tbl ; 
     Filter(
     tbl;Column1= Dropdown1.Selected.Result
     )
    )

     

     

     

     

  • dbatllevz Profile Picture
    9 on at

    Hi @Drrickryp , many thanks for your fast answer!

     

    I tried as you mentioned:

    With({tbl:AddColumns(Table1;"ColumnXY";LookUp(Table2;ColumnX=Table1[@ColumnX];ColumnY))});;If(Dropdown1.Selected.Result = "All";tbl;Table1;Filter(tbl;Table1;Column1= Dropdown1.Selected.Result))

     

    Unfortunately is giving me "Invalid argument type" error

     

    No clue what is wrong here, could you please help?

  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Your If() statement is not the same as the one I posted above.  
    If(Dropdown1.Selected.Result = "All";tbl;Table1;Filter(tbl;Table1;Column1= Dropdown1.Selected.Result))

  • dbatllevz Profile Picture
    9 on at

    Hi @Drrickryp  many thanks for the remark, it works now!

     

    I had to delete the ) after } and put it in the end:

     

    With({tbl:AddColumns(Table1;"ColumnXY";LookUp(Table2;ColumnX=Table1[@ColumnX];ColumnY))});;If(Dropdown1.Selected.Result = "All";tbl;Filter(tbl;Column1= Dropdown1.Selected.Result)))

     

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard