cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Khichi
Helper I
Helper I

How to filter Records in Browse Gallery based on current date

Hello All,

 

I am new to powerpps i just started buiding my custom application the tool is quite interesting. I am having a trouble to filter the data in gallery based on current date. The requirment is to show the today created records only in the galary. Please help me with the formula like the one i tried is 

 

Filter('FO-HK', Created = Select_x0020_Date)

 

But it is not retruning any data. The screen is blank.

 

Many Thanks in advance.

Khichi.

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions

It looks like my assumption was wrong. Your "Select_x0020_Date" is a type of Date, not Text You could have Select_x0020_Date.Text to avoid this error but before doing this, please check the following:

1. The type of the "Created" variable. Is it Text or Date?

2. Check both Created and Select_x0020_Date values (by assigning them to Labels for example) to ensure they are in the same format and time zone

3. Bring both parameters to the same standard and type. Check https://docs.microsoft.com/en-ca/powerapps/maker/canvas-apps/functions/function-date-time and https://docs.microsoft.com/en-ca/powerapps/maker/canvas-apps/show-text-dates-times for more help

4. Rewrite your formula so it has both parameters in the same standard and type.

Hope this helps.

View solution in original post

I see. You odn't need another gallery then since you can nest filter functions. For example:

BrowseGallery.Items=Filter(Filter('FO-HK', Text(Date, "[$-en-US]dd-mm-yyyy") = Text(TextSearchBox1.Text)), Column2 = TextInput2.Text)

This will first filter by date and then by Column2. You will just have to replace the Column2 with your column (from "FO-HK" source) that you want to filter by.

View solution in original post

19 REPLIES 19
dinusc
Microsoft
Microsoft

Hello Khichi,

 

A possible issue in date comparisson could be that you're trying to cmopare a Date value with a DateTime value. Try:

Filter('FO-HK', DateValue(Created) = Select_x0020_Date)

or 

Filter('FO-HK', DateValue(Created) = DateValue(Select_x0020_Date))

Hello Dinusc,

 

Thankd for your quick reponse, i tried both ways as advised by yourself but he screen is coming balnk without any dat, please see the attached screen shots. It's not mendotary to put created = select_date, actullay what i need is to show today created records only.

 

 

Many Thanks,

Khichi.

The errors (red underlines) from the second screenshot is most likely the reason your formula does not work. Can you post those errors?

Please see the attached sceen ahot for error detials:

 

Many Thanks,

Naveed.

It looks like my assumption was wrong. Your "Select_x0020_Date" is a type of Date, not Text You could have Select_x0020_Date.Text to avoid this error but before doing this, please check the following:

1. The type of the "Created" variable. Is it Text or Date?

2. Check both Created and Select_x0020_Date values (by assigning them to Labels for example) to ensure they are in the same format and time zone

3. Bring both parameters to the same standard and type. Check https://docs.microsoft.com/en-ca/powerapps/maker/canvas-apps/functions/function-date-time and https://docs.microsoft.com/en-ca/powerapps/maker/canvas-apps/show-text-dates-times for more help

4. Rewrite your formula so it has both parameters in the same standard and type.

Hope this helps.

View solution in original post

Thanks dear it was a great help i tried to filter with below formula

 

Filter('FO-HK', DateValue(Date) = DateValue(Date))

One more clarification if i want to put search through textbox how i will achieve this.

I assume you did not want to include the "Date" column 2 times in your formula. 

If you wanted to search according to a value from a text box, then the following should work:

Filter('FO-HK', DateValue(Date) = DateValue(TextInput1.Text))

This assumes that "Date" as a text field from your "FO-HK" source and TextInput1 is the text input control that contains the date value the source needs to be filtered on.

Yes you are 100% right i want to compare the

DateValue(Date) with current date

Can you please guide this. Also if possible to put the search filter as well within the same formula.

 

 

Many Thanks

 

Hi Dinusc,

 

Thanks for putting me on right track i figure it out by adding a textinput and then got the current date with it and compare it in the filter like below

 

Filter('FO-HK', Text(Date, "[$-en-US]dd-mm-yyyy") = Text(TextInput1.Text))

It is working perfectly, now only one more query i just want to add search feature within the above filter to search the record based on user in put in the serach textbox.

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.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,481)