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 / Filter the skipped dates
Power Apps
Unanswered

Filter the skipped dates

(0) ShareShare
ReportReport
Posted on by 12

Hi Guys,

 

I've just started a new app and need some help please. In my app i need to filter the date that been skipped.

For example:

This is the output of my program:                                          The output that I want is:

5/20/2022                                                                               5/23/2022

5/21/2022                                                                               5/25/2022

5/24/2022                                                                               5/26/2022

5/27/2022

 

 And this is my codes:

 

Distinct(
Filter(
[@Pending],
StartDate >= varDateFrom && StartDate <= varDateTo,
StartsWith(
TimeSheetGroup,""
),
Title = Title2.Text
),
TimeSheetDate
).Result

 

Hope you can help me with this I'm just a newbie in power apps.

 

 

Categories:
  • Waegemma Profile Picture
    583 Super User 2024 Season 1 on at

    Hi @JnB ,

     

    (credits to @WarrenBelz in this post Generate fake data for testing app - Power Platform Community (microsoft.com) for pointing out the existence of sequence 🙂 )

     

     

     

    Set(varDateFrom,Today()),
    Set(varDateTo,DateAdd(Today(),10)),
    // Collect a Date Range between DateFrom and DateTo
    ClearCollect(colAllDates,
     ForAll(
     Sequence(DateDiff(varDateFrom,varDateTo)),
     {AllDate: DateAdd(varDateFrom,Value)})),
    // Collect a mock-list of Dates that were selected
    ClearCollect(colSelectedDates,
     ForAll(
     Sequence(DateDiff(varDateFrom,varDateTo),1,2),
     {SelectedDate: DateAdd(varDateFrom,Value)})),
    // Collect a list of Skipped Dates that are not in the list of Selected Dates
    ClearCollect(colSkippedDates, ForAll(Filter(colAllDates, Not(AllDate in colSelectedDates.SelectedDate)),{SkippedDate:AllDate}))

     

     

    This makes a list of the dates between DateFrom and DateTo.

    Then it makes a mocklist of selected dates, use your own list instead.

    Then it compares these two lists and captures the ones that were not selected.

     

    Hope this helps,

     

    Marc

  • JnB Profile Picture
    12 on at

    Hi @Waegemma 

    How can I apply this codes to gallery? because I want to view the output skipped dates. Sorry for this question I'm really newbie in powerapps.

  • Waegemma Profile Picture
    583 Super User 2024 Season 1 on at

    Hi @JnB ;

     

    Change the gallery items to:

     

    Filter(YourList; YourDateField in colSkippedDates.SkippedDate)

     

    Marc

     

     

  • JnB Profile Picture
    12 on at

    Hi @Waegemma 

     

    Why in this part 

    DateAdd(varDateFrom,Value)

     I received an error "Expected date. We expect a date at this point in the formula".

  • Waegemma Profile Picture
    583 Super User 2024 Season 1 on at

    Hi @JnB ,

     

    I used your variables varDateFrom and varDateTo, seemed like they were dates? How are they set?

     

    Also, I noticed I used the default in DateAdd, maybe it's better to be explicit:

     

    DateAdd(varDateFrom, Value, Days) 

     

    Marc

  • JnB Profile Picture
    12 on at

    Hi @Waegemma 

    Good day

     

    The varDateFrom and varDateTo was set 

     

    Set(
    varDateFrom,
    Value(
    Text(
    Today() - 7,
    "[$-en-US]yyyymmdd"
    )
    )
    );
    Set(
    varDateTo,
    Value(
    Text(
    Today(),
    "[$-en-US]yyyymmdd"
    )
    )
    );

     

    And still I receive the error.

  • Waegemma Profile Picture
    583 Super User 2024 Season 1 on at

    Hi @JnB ,

     

    Try using:

     

    Set(varDateFrom,DateAdd(Today(),-7,Days));
    Set(varDateTo,Today())

     

    Marc

  • JnB Profile Picture
    12 on at

    Hi @Waegemma 

     

    The error is still the same "Expected date. We expect a date at this point in the formula" 

    Set(varDateFrom,DateAdd(Today(),-7,Days));
    Set(varDateTo,Today())
  • v-bofeng-msft Profile Picture
    Microsoft Employee on at

    Hi @JnB ,

     

    If you only wants to get the date that been skipped, just use '!' to reverse the original filter condition. Something like:

     

     

    Distinct(
    Filter(
    [@Pending],
    !((StartDate >= varDateFrom && StartDate <= varDateTo) && (StartsWith(TimeSheetGroup,"") && Title = Title2.Text)
    ),
    TimeSheetDate
    ).Result

     

    Best Regards,

    Bof

  • JnB Profile Picture
    12 on at

    Hi @v-bofeng-msft 

    Good day

     

    I try your code but the output is not correct

    instead of 5/23/2022, 5/25/2022, 5/26/2022 

    the output is 4/1/2022, 4/2/2022 and so on.

     

    Distinct(
    Filter(
    [@Pending],
    !((StartDate >= varDateFrom && StartDate <= varDateTo) && (StartsWith(TimeSheetGroup,"")&&Title = Title2.Text))
    ),
    TimeSheetDate
    ).Result

     

    This is the output of my program:                                          The output that I want is:

    5/20/2022                                                                               5/23/2022

    5/21/2022                                                                               5/25/2022

    5/24/2022                                                                               5/26/2022

    5/27/2022

     

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 250

#3
Mohsin Ali Profile Picture

Mohsin Ali 225

Last 30 days Overall leaderboard