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 / Count days in a Galler...
Power Apps
Answered

Count days in a Gallery for all Items

(0) ShareShare
ReportReport
Posted on by 228

Hi Forum,

 

i have a gallery with some items (it comes from SP List). Every item has a startdate and an enddate.

How can i count the days between start an enddate? 

I need the days for all items in the gallery and not for one item.

 

Thanks 😉

Categories:
  • kajsiretardiran Profile Picture
    98 on at

    Depends what you need exactly but something like this (this is for the time)

    Add a text field inside of the gallery and as text write 
    Text(ThisItem.EndDate;"hh,mm")-Text(ThisItem.StartDate;"hh,mm")

  • Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @Tamer66 ,

     

    Insert a label control inside your Gallery

    Enter the following code:

    DateDiff(
     StartDate,
     EndDate,
     TimeUnit.Days
    )

     

    Replace your items in above syntax and you will get days for each records displayed in Gallery

     

    Hope this helps

  • Tamer66 Profile Picture
    228 on at

    I undestand the DateDiff Function but how can i count the diff for all records at once?

     

    eg.

    Record 1: datediff=2

    Record 2: datediff=4

     

    Label for count: 6 Days

  • kajsiretardiran Profile Picture
    98 on at

    Can you be more specific? 

    You want to calculate the difference between StartDate and EndDate and then sum all the records or something else?

  • Verified answer
    Ethan_009 Profile Picture
    4,840 Moderator on at

    Hi @Tamer66 ,

     

    Reference Blog

     

    Now, since this is a label control, you need to check if you're getting Label in the syntax.

    Sum(Gallery1.AllItems, lblDateDiff.Text)
    
    //OR
    
    Sum(Gallery1.AllItems, Value(lblDateDiff.Text))

     

    Hope this helps

  • Tamer66 Profile Picture
    228 on at

    Exactly, i need the sum (days) of all records.

    i can show the difference of the date in days with DateDiff() for one record, but what i need ist the sum  (days) of all records

  • kajsiretardiran Profile Picture
    98 on at

    you can do the DateDiff inside of the gallery for each record when the end date is entered and patch the DateDiff record to the sharepoint and then do the Sum(Gallery1.AllItems, Value(NameoftheDifffield.text)) 

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard