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

Get YEAR and compare with dropdown Year for filter

I am trying to get the year from a date in dataverse. Then compare that year to the text dropdown I have for the years to be able to filter the list.  For some reason, the line in RED is giving me issues (probably because I don't know what I am doing) 

 

 

 

rlavigne99_0-1632268194872.png

rlavigne99_1-1632268344880.png

 

rlavigne99_2-1632268470728.png

No Idea what I am doing wrong. I feel like its me not understanding how a date gets converted to a number or text that I can use to compare with the text from the dropdown. 

 

 

SortByColumns(
    If(Text(DropdownPPYear.Selected.Value) = "All",
    Filter(
        'ITCosting PrePaid Schedules',
         PmtMonthDate >= DateAdd(Now(),1, Years) && 
         VendorSearchInput.Text in Vendor
    ),
    Filter(
        'ITCosting PrePaid Schedules',
        Text(Value(Year(PmtMonthDate))), >= Value(DropdownPPYear.Selected.Value) &&                      
        VendorSearchInput.Text in Vendor 
    )
    ),

"crd83_pmtmonthdate",  
SortOrder.Ascending 
)  

 

rlavigne99_3-1632268592643.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
mate_toth
Resolver I
Resolver I

Hi @rlavigne99 , 

It looks like there is an extra comma after the ValuePmtMonthDate))), and the Text isn't needed. Can you try with this one?

Value(Year(PmtMonthDate)) >= Value(DropdownPPYear.Selected.Value)

 

View solution in original post

2 REPLIES 2
mate_toth
Resolver I
Resolver I

Hi @rlavigne99 , 

It looks like there is an extra comma after the ValuePmtMonthDate))), and the Text isn't needed. Can you try with this one?

Value(Year(PmtMonthDate)) >= Value(DropdownPPYear.Selected.Value)

 

View solution in original post

rlavigne99
Helper I
Helper I

This was the final code that seems to have worked properly. I thank you for your help. I hate commas! haha

SortByColumns(
    If(Text(DropdownPPYear.Selected.Value) = "All",
    Filter(
        'ITCosting PrePaid Schedules',
        VendorSearchInput.Text in Vendor &&
        PmtMonthDate >= DateAdd(Now(),0, Years) 
         
    ),
    Filter(
        'ITCosting PrePaid Schedules',
        Value(Year(PmtMonthDate)) >= Value(DropdownPPYear.Selected.Value) &&
        // Text(Value(Year(PmtMonthDate))), >= Value(DropdownPPYear.Selected.Value) &&                      
        VendorSearchInput.Text in Vendor 
    )
    ),

"crd83_pmtmonthdate",  
SortOrder.Ascending 
)  

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,925)