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 / Gallery count items pr...
Power Apps
Answered

Gallery count items problem.

(0) ShareShare
ReportReport
Posted on by 3

Hi,

I’m having an issue finding a solution, I hope someone can help. 

In my app, I have a screen where I use a date picker, and a gallery provides available vehicles between those dates. I have used the count.allitems to produce a total of how many vehicles are available to the user. The user then books an available vehicle. 

Another screen I have contains two galleries. Based on the date pickers selected on this screen, Gallery 1 returns results from a collection of vehicles. When a vehicle is selected in this gallery, Gallery 2 then shows the bookings for that vehicle within the date period selected. 

I want to display the number of bookings in Gallery 2 next to each item in Gallery 1. This would enable the user to see how many bookings each vehicle has instead of clicking each item in Gallery 1 to display them in Gallery 2. 

Note: I know I could use a better display method such as a calendar, but this is part of a function to take a vehicle ‘off road’ so I have designed the screen this way intentionally. 

Any help is appreciated. Thank you in advance. 

Ross

Categories:
  • Verified answer
    v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @Ross1111 :

      Could you describe your needs and the data structure of the data table in detail? (Preferably some screenshots)

      If you can provide the data structure of the vehicle reservation table, then I think I might be able to provide a better solution.

      I assume there is a table 'vehicle booking' like this:

    ClearCollect(
     'vehicle booking',
     {OrderID:1,VehicleName:"Vehicle1",Date:Date(2021,1,15),Quantity:10},
     {OrderID:2,VehicleName:"Vehicle1",Date:Date(2021,1,14),Quantity:5},
     {OrderID:3,VehicleName:"Vehicle1",Date:Date(2021,1,15),Quantity:12},
     {OrderID:4,VehicleName:"Vehicle1",Date:Date(2021,1,15),Quantity:10},
     {OrderID:5,VehicleName:"Vehicle2",Date:Date(2021,1,14),Quantity:5},
     {OrderID:6,VehicleName:"Vehicle2",Date:Date(2021,1,15),Quantity:12},
     {OrderID:7,VehicleName:"Vehicle2",Date:Date(2021,1,14),Quantity:10},
     {OrderID:8,VehicleName:"Vehicle2",Date:Date(2021,1,13),Quantity:5},
     {OrderID:9,VehicleName:"Vehicle2",Date:Date(2021,1,12),Quantity:12}
    )

    Please check if the content of the gif presentation below meets your requirements.

      32.gif

    If so,please try this soluiton:

    1\Add a DatePicker(DatePicker1) control

    2\Add a gallery(Gallery1) control and set it's items property to:

    GroupBy(
     Filter(
     'vehicle booking',
     Date = DatePicker1.SelectedDate
     ),
     "VehicleName",
     "NewGroup"
    )

    3\Add two labels into Gallery1

    Label1-Text

    ThisItem.VehicleName

    Label2-Text

    "The total amount:"&Char(13)&Sum(ThisItem.NewGroup,Quantity)

     4\Add a gallery(Gallery2) into Gallery1 and set it's items property to:

    ThisItem.NewGroup

    5\Add two labels into Gallery2

    Label3-Text

    "OrderID:"&ThisItem.OrderID

    Label4-Text

    "Quantity:"&ThisItem.Quantity

     Best Regards,

    Bof

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 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard