cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gene
Level: Powered On

Populate a dropdown from a List where I need to filter by a date

Probably a newbie issue.

 

This is this the formula I am trying to use to populate a fitered list in a dropdon.

 

It seems PowerApps does not see the ( Schedule.'Week of' ) as date.   This is clearly setup as a date within the list.

 

 

Distinct(Filter(Schedule, DateDiff(Schedule.'Week of', DateAdd(Today(), -Weekday(Today())+2)) = 0), Schedule.Target)

I get a invalid argument type.

 

1 ACCEPTED SOLUTION

Accepted Solutions
gene
Level: Powered On

Re: Populate a dropdown from a List where I need to filter by a date

I am afraid I have moved to a simpler solution.   So I can no longer provide any more details.

 

You are welcome to delete the thread.

View solution in original post

4 REPLIES 4
gene
Level: Powered On

Re: Populate a dropdown from a List where I need to filter by a date

A little more troubleshoooting.....  I found out Poweapps is seeing the SP List Field as a number and it's a large number like excel's native format.

 

So now how do I convert Today's date to a number or convert the List date field 'Week of' to a date for comparison?

Highlighted
gene
Level: Powered On

Re: Populate a dropdown from a List where I need to filter by a date

So thinking the the date field in SharePoint 'Week of' is in a "DateValue" format, I tried setting this part in a DateValue "DateAdd(Today(), -Weekday(Today())+2)" So the entire formula would be

 

Distinct(Filter(Schedule, DateDiff(Schedule.'Week of', DateValue(DateAdd(Today(), -Weekday(Today())+2))) = 0), Schedule.Target)

I still get a Invalid argument type on the operator. 


Still lost.

Community Support Team
Community Support Team

Re: Populate a dropdown from a List where I need to filter by a date

Hi @gene,

Could you please share more details about your error message with your formula in your app?

Based on the formula that you mentioned, I have made a test, and don't have the issue that you mentioned. The screenshot as below:2.JPG

If the 'Week of' column is a Date type column in your SP list, I think there is no syntax error with the formula that you provided.

Please take a try to modify your formula as below:

Distinct(
Filter(Schedule, DateDiff('Week of', DateAdd(Today(), -Weekday(Today())+2)) = 0),
Target
)

In addition, if PowerApps recognize the 'Week of' column (of your 'Schedule' SP list) as a Number type column, and you want to convert the 'Week of' column value into a Date value, please take a try with the following workaround:

Distinct(
Filter(
Schedule,
DateDiff(DateValue(Text('Week of')), DateAdd(Today(), -Weekday(Today())+2)) = 0
),
Target
)

If the issue still exists, please consider take a try to re-create your SP list, and create a new app based on this SP list, try above formula again, check if the issue is solved.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
gene
Level: Powered On

Re: Populate a dropdown from a List where I need to filter by a date

I am afraid I have moved to a simpler solution.   So I can no longer provide any more details.

 

You are welcome to delete the thread.

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,597)