cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

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