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

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

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 846

#2
Valantis Profile Picture

Valantis 532

#3
Haque Profile Picture

Haque 410

Last 30 days Overall leaderboard