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
Highlighted
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.

2 REPLIES 2
Highlighted
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.

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
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 501 members 4,642 guests
Please welcome our newest community members: