cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mariverjean
Frequent Visitor

Show only available in Gallery based on 2 different tables

Hi,

 

I'm creating a carpool application whereas I'm on the screen for showing the list of available drivers. I'm using excel as may database. 

 

I dont want to show those drivers with full booking. On the list of drivers, I have a table with the passenger capacity (integer) and I have a separate table for drivers booked. So I'll use the count or the number of entries on my 2nd table to compare it to the passenger capacity. Is this event possible? 

 

Thank you. 

1 ACCEPTED SOLUTION

Accepted Solutions

@mariverjean 

You can add an additional criteria to check if Passengers is greater than or equal to the COUNTROWS of the BookedDrivers table filtered by the driver name

 

Filter(
    DriverDetails,
    Time = DataCardValue2.Selected.Value,
    City = DataCardValue3.Selected.Value
    Passengers >= CountRows(Filter(BookedDrivers, Driver = DriverDetails[@Name]))
)

 

Note: your screenshots were very helpful.  Thank you for posting them!

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

4 REPLIES 4
mdevaney
Super User III
Super User III

@mariverjean 
Can you please provide some sample data from the tables? It will help the forum members give you a better response.

Hi @mdevaney ,

 

For the passenger capacity from driver side and booked drivers, here are the tables. 

 

Here's the table with capacity numberHere's the table with capacity numberTable for booked drivers. if the count of the driver name is 2, meaning the driver cant accept any bookings and I dont want to show him on my gallery.Table for booked drivers. if the count of the driver name is 2, meaning the driver cant accept any bookings and I dont want to show him on my gallery.

 

I dont want them to show on my gallery by adding a condition that if the number of rows in booked drivers tables = passenger capacity, the name of the driver will not show. Here's my current formula for the gallery. 

 

Filter(DriverDetails,(Time = DataCardValue2.Selected.Value) And City=DataCardValue3.Selected.Value)

 

Thanks!

@mariverjean 

You can add an additional criteria to check if Passengers is greater than or equal to the COUNTROWS of the BookedDrivers table filtered by the driver name

 

Filter(
    DriverDetails,
    Time = DataCardValue2.Selected.Value,
    City = DataCardValue3.Selected.Value
    Passengers >= CountRows(Filter(BookedDrivers, Driver = DriverDetails[@Name]))
)

 

Note: your screenshots were very helpful.  Thank you for posting them!

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

@mdevaney  

 

 

Cool!! Just added a few logic and worked fine! 🙂

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (970)