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

Dropdown with items that meet certain criteria

I have two SharePoint Lists, one has the item only once with it's information. The other SP list has many entries for that item or items. I would like the dropdown to display the ID's that their last EntryDate was over 30 days old.

 

List1 (One) to List2 (Many)

 

LIST1: Fields: ID (Unique), Description

LIST2: Fields: ID, EntryDate

 

Example Data: List1

ID          Description

PM1      Red Fire Hose

PM2      Blue Fire Hose

PM3      Orange Fire Hose

 

Example Data: List2

ID         EntryDate

PM1     12/1/2019

PM1     1/1/2020

PM2     12/2/2019

PM2     1/2/2020

PM3     12/3/2019

PM3     1/3/2020

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Dropdown with items that meet certain criteria

Hi @dmac73 

 

Can you try to use the expression:

Filter(AddColumns(GroupBy(List2,"ID","Grouped"), "LastDate", First(Sort(Grouped, "EntryDate", Descending)).EntryDate), EntryDate < DateAdd(Today(),-30, Days)).ID

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

3 REPLIES 3
Microsoft v-siky-msft
Microsoft

Re: Dropdown with items that meet certain criteria

@dmac73 

 

Do you mean you want to show ID that its last entry date is 30 days before today?

What is the data source? I assume it is Sharepoint list.

Set the following codes to OnVisible property of screen:

 

 

Clear(Col1);Clear(Col2);ForAll(Distinct(list2,ID.Value).Result,Collect(Col1,Last(SortByColumns(Filter(list2,ID.Value=Result),"EntryDate",Ascending)));Collect(Col2,If(Last(Col1).EntryDate<DateAdd(Now(),-30,Days),Last(Col1).ID.Value)))

 

 

Set Items property of combo box:

 

 

Filter(Choices(list2.ID),Value in Col2.Value)

 

 

Note: ID in the formula is not the Sharepoint items unique Id, it is the column name in your example.

Snipaste_2020-01-23_15-55-07.pngSnipaste_2020-01-23_15-54-12.png

Sik

dmac73
Level: Powered On

Re: Dropdown with items that meet certain criteria

I see I would only need to access List2 for the data? The code your recommend is different from you last picture. 

The code does not display any errors in the OnVisible but the collections do not collect and data. 

Dual Super User
Dual Super User

Re: Dropdown with items that meet certain criteria

Hi @dmac73 

 

Can you try to use the expression:

Filter(AddColumns(GroupBy(List2,"ID","Grouped"), "LastDate", First(Sort(Grouped, "EntryDate", Descending)).EntryDate), EntryDate < DateAdd(Today(),-30, Days)).ID

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,933)