web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Make item in gallery v...
Power Apps
Answered

Make item in gallery visible if between 2 specific dates (dataverse source)

(0) ShareShare
ReportReport
Posted on by 1,257 Super User 2024 Season 1

I am trying to achieve the following

 

I have a label in gallery which I want to be visible if  ThisItem.Startdate  is between 2 dates (inclusive)

These 2 dates are in a separate dataverse table   Called UserDatesTable  and I have views for each of these dates so for example  UserDateView1    is filtered to show a start date and an end date.  So what I would like it see in my gallery  is

 

If thisitem.startdate is between UserDatesTable (with the view UserDateView1) then make this visible if not invisible etc..  

 

Any ideas on the best way to achieve this?  I can figure it out when it's a sharepoint list but with dataverse as datasource it behaves differently.

 

TIA

Categories:
I have the same question (0)
  • RoopeKorpela Profile Picture
    127 on at

    If(ThisItem.StartDate >= UserDateView1.StartDate && ThisItem.StartDate <= UserDateView1.EndDate, true, false)

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    That won't work for dataverse unfortunately Roope that I can see anyway?   That would be the usual way I'd do it.

     

     

  • RoopeKorpela Profile Picture
    127 on at

    Use LookUp() to get the StartDate from the Dataverse table/view table and same to the EndDate.

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    THanks @RoopeKorpela  but not quite sure what you mean? How should I use lookup? in this scenario

  • RoopeKorpela Profile Picture
    127 on at

    Did you mean something like this:

    RoopeKorpela_0-1680160616778.png

     

  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    Thanks @RoopeKorpela  for your help so far but I've decided to take a different approach to simplify it and rather than using the date dataverse table I'm going to use hardcoded dates because there are only 6 variations anyway...  however still struggling with that 

     

    If(DPMyDate.SelectedDate>=Date(2023,01,01) && DPMyDat.SelectedDate<=Date(2023,01,09),true,false)

    No errors but not giving the right response

     

  • RoopeKorpela Profile Picture
    127 on at

    Hmm, seems to work for me. You can see the Item 1 and 3 are not in the range.

    RoopeKorpela_0-1680161215303.png

     

  • Verified answer
    rswain Profile Picture
    173 on at
    You can use the LookUp function to retrieve the appropriate record from the UserDatesTable based on your filtering criteria (e.g. using UserDateView1). Then, you can compare the StartDate and EndDate values of that record with the StartDate value of ThisItem to determine if the label should be visible.
    
    Here's an example formula that should work:
    
    If(
     And(
     ThisItem.StartDate >= LookUp(UserDatesTable, UserDateView1, StartDate),
     ThisItem.StartDate <= LookUp(UserDatesTable, UserDateView1, EndDate)
     ),
     Visible,
     Hidden
    )
    This assumes that you have a StartDate and EndDate column in your UserDatesTable and that the UserDateView1 view is filtered to show the appropriate date range. You can adjust the view name and column names as needed.
    
    Note that this formula sets the Visible property of the label to true if the StartDate of ThisItem falls within the date range in the UserDatesTable view, and sets it to false otherwise. You can adjust the Visible and Hidden values as needed to match your requirements.
  • vffdd Profile Picture
    1,257 Super User 2024 Season 1 on at

    THank you

  • RoopeKorpela Profile Picture
    127 on at

    Just to note that you accepted as a solution the reply that is tagged as "invalid ChatGPT code". The code sets Visible/Hidden which is incorrect. It should be true/false.

     
     

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard