cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

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
Super User
Super User

Re: Comparing Months

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
Super User
Super User

Re: Comparing Months

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

Super User
Super User

Re: Comparing Months

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
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 127 members 5,455 guests
Please welcome our newest community members: