Showing results for 
Search instead for 
Did you mean: 
Resolver I
Resolver I

Get the month-year for comparison

Hi friend, 


I wanna extract month-year from the date data type from "get rows" in SQL server to compare current month-year. 

If month-year in SQL server is equal to current month-year, send the email. 


Could anyone help me on this? 

Thank you for your time. 

Memorable Member
Memorable Member

Hi @tracytran ,


You can use the formatDateTime expression and convert both of them to the same format and then do the comparison.


  • Variable coming from SQL Server:

          formatDateTime(<variable here>, 'MMM-yyyy')


  • Current UTC Date:

         formatDateTime(utcNow(), 'MMM-yyyy')



MMM will get the month like Jan/ Feb/ Mar and yyyy will get the year as 2021

So compare the outputs of both the above statements as normal strings.

If the strings match (eg; Oct-2021 for both) then it is time to send the email.


@VJR Thank for your solution. 


Here is my flow:



In my table in SQL, I have many rows and OrderDate column, which has date data type. I would like to check whether every single row with OrderDate is equal to the current month-year. 


 I got the month-year from SQL Server by creating a compose with this expression: 





It seems that I only get the order date of the 1st row in SQL table and then apply that value for all other rows. 

How could I make it work correctly? 

Any help is highly appreciated. 

Memorable Member
Memorable Member

Hi @tracytran 

Is there  a specific reason you have used "first"? What happens when you remove the "first" function?

I haven't got SQL server on my machine so that I could tell you the exact syntax. Could you please check out some "solved" posts on this forum. I'm sure there are many on SQL server.

Helpful resources

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.

Users online (2,494)