cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ericonline
Community Champion
Community Champion

Comparing Months

I'm performing a comparison between Todays month and the month an evaluation was submitted to a Sharepoint list.

 

The Month value is being written to the Sharepoint list with the function: 

Month(evaluationDate_datePicker.SelectedDate)

This results in "8" for August.

 

The comparison to the Sharepoint column is being done with this function: 

 

Text(Today(),"[$-en-US]mm")

 

This results in "08" for August.

 

 

The values do not compare correctly because of the "0" prefix the Text(Today function places in front of single digit months. To try and compare apples to apples, I wrapped the Month function in the Text function: 

 

Text(Month(evaluationDate_datePicker.SelectedDate),"[$-en-US]mm")

Unfortunately, this results in "12".

 

  1. How can I compare months?
  2. Why did the function above result in "12"

 

1 ACCEPTED SOLUTION

Accepted Solutions
Drrickryp
Super User II
Super User II

Hi Eric,

 

Try wrapping 

Text(Month(evaluationDate_datePicker.SelectedDate),"0#") 

 to see if that works.  I don't know why your third function results in 12 though.

View solution in original post

2 REPLIES 2
Drrickryp
Super User II
Super User II

Hi Eric,

 

Try wrapping 

Text(Month(evaluationDate_datePicker.SelectedDate),"0#") 

 to see if that works.  I don't know why your third function results in 12 though.

View solution in original post

Awesome! Thanks @Drrickryp. That did indeed work. 

 

I hacked in the following, just to get things working in the interim:

 

If(
    Len(
        Text(Month(evaluationDate_datePicker.SelectedDate),"[$-en-US]##")) = 1,
        "0" & Month(evaluationDate_datePicker.SelectedDate),
        Month(evaluationDate_datePicker.SelectedDate)
)


But will definitely revert to your, more elegant solution now. Man LOL

 

I will also read up on Text formatting. 

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.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,440)