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 / LookUp with Multiple C...
Power Apps
Answered

LookUp with Multiple Condition

(0) ShareShare
ReportReport
Posted on by 709

Hi All,

 

I am looking for help in Lookup Function in Powerapps.
I have two galleries and I want the Text which is HB Hours to be populated with sum of another Gallery which has multiple entries of the same User Name Queue Name and date.

 

I want total duration in Hb Hours

 

What formula shall set to get the desired result

 

 

akbarmahfuzalam_0-1620034014295.png

 

akbarmahfuzalam_1-1620034263228.png

 

Thanks in advance

 

Categories:
  • zaphod88 Profile Picture
    502 on at

    Are there lists/collections for both of the galleries?
    Try
    Sum(Filter(Gallery2.AllItems, 'Process Date'.SelectedDate = DateGallery2.SelectedDate, 'User Name'.Text = UserNameGallery2.Text, 'Queue Name'.Text = QueueNameGallery2.Text).TotalDuration.Text)
    You have to replace the input names with your own, of course.

  • akbarmahfuzalam Profile Picture
    709 on at

    @zaphod88 

    Thanks for your answer.

    I tried to implement the code but unfortunately, it didn't work for me.

     

    akbarmahfuzalam_0-1620039848919.png

     

    And I have 

    akbarmahfuzalam_1-1620039943252.png

     

    akbarmahfuzalam_2-1620040195551.png

     

    akbarmahfuzalam_3-1620040253917.png

    Activity Name is Queue Name

    ShiftDate is WorkedDate

    EID is UserName/Title

     

    akbarmahfuzalam_4-1620040354215.png

     

  • zaphod88 Profile Picture
    502 on at

    Try:

    Sum(Filter(GalleryHB.AllItems, Label2_4.SelectedDate = Text(ShiftDate,DateTimeFormat.ShortDate,"en-US"), Lbl_UserName.Text = EID, Lbl_QueueName.Text = 'Activity Name').tDuration)

    I hope I got all column and label names right - if not, you may have to correct them. You already get a delegation warning - I think it's a good idea to ClearCollect(CollHBData,HBData) and use the collection instead of the SP list.

  • akbarmahfuzalam Profile Picture
    709 on at

    @zaphod88 

     

    I tried the below formula and even i tried to used the CollHBData but its fetching an error

    akbarmahfuzalam_1-1620051966713.png

     


    @zaphod88 wrote:

    Try:

    Sum(Filter(GalleryHB.AllItems, Label2_4.SelectedDate = Text(ShiftDate,DateTimeFormat.ShortDate,"en-US"), Lbl_UserName.Text = EID, Lbl_QueueName.Text = 'Activity Name').tDuration)

    I hope I got all column and label names right - if not, you may have to correct them. You already get a delegation warning - I think it's a good idea to ClearCollect(CollHBData,HBData) and use the collection instead of the SP list.




     

    Sum(Filter(GalleryHB.AllItems, Lbl_WorkedDate.SelectedDate = Text(ShiftDate,DateTimeFormat.ShortDate,"en-US"), Lbl_UserName.Text = EID, Lbl_QueueName.Text = 'Activity Name').PDur)

     

  • zaphod88 Profile Picture
    502 on at

    My fault. Try replacing the point before PDur with a comma, so:

    Sum(Filter(GalleryHB.AllItems, Lbl_WorkedDate.SelectedDate = Text(ShiftDate,DateTimeFormat.ShortDate,"en-US"), Lbl_UserName.Text = EID, Lbl_QueueName.Text = 'Activity Name'),PDur)

  • akbarmahfuzalam Profile Picture
    709 on at

    @zaphod88 

     

    Still, I find an error as mention below.

    I tried the below formula as well

     

    Sum(Filter(CollHBData, Lbl_WorkedDate.Text = Text(ShiftDate,DateTimeFormat.ShortDate,"en-US"), Lbl_UserName.Text = EID, Lbl_QueueName.Text = 'Activity Name'),PDur)

     

    But I am not getting any value. The label is blank.

    akbarmahfuzalam_2-1620055142317.png

     

     

    akbarmahfuzalam_1-1620054414713.png

     

  • zaphod88 Profile Picture
    502 on at

    Maybe a silly question, but: Are there any items that match the Filter() conditions? Enter a name, a date and a Queue Name that are corresponding to an item in the gallery/the Sharepoint list into the labels and see if it works then. Maybe there is no item in the Sharepoint list that matches all three criteria.

    If PowerApps is showing no errors, at least the syntax is correct. As I don't know if I got all those labels right, try to remove 1 or 2 conditions for testing purposes and see if it works then. You could also try to replace the Text(...) just by ShiftDate.

  • akbarmahfuzalam Profile Picture
    709 on at

    @zaphod88 

     

    I tried that way as well

    akbarmahfuzalam_4-1620057543680.png

     

     

     

    akbarmahfuzalam_1-1620057280371.png

     

    akbarmahfuzalam_2-1620057389765.png

     

     

     

  • zaphod88 Profile Picture
    502 on at

     

    Found a problem:

    zaphod88_0-1620058104494.png

    Could you try it again after correcting? 

  • akbarmahfuzalam Profile Picture
    709 on at

    @zaphod88 

     

    Did that

    akbarmahfuzalam_0-1620058558156.png

     

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard