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 / Two lookup functions n...
Power Apps
Unanswered

Two lookup functions not working

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

hi, i have a problem with the code where there are two lookup functions. When i remove:

 

DATE >= DateValue1.SelectedDate,
NID = "pla"

and in the second lookup

LID = "A"

The formula works for some cases, but I need these conditions.

 

 

With(
 {
 varID: LookUp(
 Filter(
 TABLE,
 AID = "aab",
 DATE >= DateValue1.SelectedDate,
 NID = "pla"
 ),
 ITEMID = DataCardValue3.Text,
 ID
 )
 },
 LookUp(
 Filter(
 TABLE2,
 AID = "aab",
 LID = "A"
 ),
 PDID = varID,
 IID
 )
)

 

I think that problem is in a DateValue1.SelectedDate, because in the database, a column with date have a dd.mm.yyyy format. And DateValue1.SelectedDate return date in dd/mm/yyyy format.

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,928 Most Valuable Professional on at

    Hi @Anonymous ,

    What is your data source? If is is SharePoint, as long as the date is stored in a Date/Time field, it does not matter what format you are displaying it in as the Date Picker underlying date is in the same format as the List date.

    Try the code below - also you do not need Filter if you are doing a Lookup.

    With(
     {
     varID: 
     LookUp(
     TABLE,
     AID = "aab" && 
     DATE >= DateValue1.SelectedDate &&
     NID = "pla" &&
     ITEMID = DataCardValue3.Text
     ).ID
     },
     LookUp(
     TABLE2,
     AID = "aab" &&
     LID = "A" &&
     PDID = varID
     ).IID
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    My datasorce is a database, i am connected to it via sql server.

  • WarrenBelz Profile Picture
    154,928 Most Valuable Professional on at

    @Anonymous ,

    Firstly, can you please state your data source in every post you do, as it will often affect the response significantly - please take a few minutes to read this guide

    Did you try the code I posted?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Unfortunately, I can not. I tried the code but it still doesn't return any results, you can only see a constantly loading bar at the top of the page. I have one more question if the function returns more than one result, could this affect the display of the data? Therefore, it does not display any record? I created a similar query in Excel, but there I use distinct to eliminate duplicate records. Maybe there is simply too much of this data? When I add distinct in excel to the query, it returns 4 records to me, without distinct, I get over 30

  • timl Profile Picture
    36,785 Super User 2026 Season 1 on at

    @Anonymous 

    This appears to be a duplication of this post, which I have commented on beneath.

    https://powerusers.microsoft.com/t5/Building-Power-Apps/How-to-remove-duplicates-from-two-lookup-functions/m-p/1399451#M363603

     

    Also, could you clarify the SQL data type of [Table].[Date]? Is a datetime column, or is it a text/varchar/nvarchar column?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    [Table].[Date] is a datetime column.

  • timl Profile Picture
    36,785 Super User 2026 Season 1 on at

    @Anonymous 

    If that's the case, the 'view' suggestion in my other post will broadly work without any additional adaptation. As @WarrenBelz  says, if the underlying data type is Datetime, the format doesn't matter.

     

    I would also suggest that you post screenshots of your actual data if that is possible, because it's very difficult to establish the output that you actually require based on formula that doesn't work, especially now it appears that you want to return only distinct results.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    unfortunately, I don't know how to solve this problem even by creating a view in SQL

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 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard