Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
suresh_qv50
Creator
Creator

Maximum Year-Month to be get in a Variable

Hi Team,

I have field [OriginYear-Month] Values are like, 2016-12,2016-11' - - - - 2014, these values getting from sqlserver,

Now requirement is , i need to pick latest year-Month(2016-12) dynamically from field to a variable, and i need to use that variable and evaluate some other months by using Addmonths Function.

i tried initially firstsortedvalue at that time i got solution, now its not working ,

Can any one suggest better solution for my requirment

Regards

suresh

1 Reply
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi Suresh,

The best option I see is create a Year Month from this data using Monthname Function.

Something like below.

Monthname(Makedate(Left(Field,4),Right(Field,2))) as MonthYear.

Now you can simply use the Max function or Maxstring function to get the maximum month year.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!