Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

First date from YearMonth field

Good day!

Is any way to get first date for every YearMonth?

In model i have only one period field YearMonth

I need to get such values:

YearMonth     Date

201401     01.01.2014

201402     01.02.2014

201507     01.07.2015

....

Thanks.

11 Replies
Anonymous
Not applicable
Author

Thanks.. but LastYTDFlag works not for my need.

For example:

if max YearMonth is 201503 = LastYTDFlag must include 201401,201402,201403

And what about MTD and PriorMTD?

sunny_talwar

Updated my last response:

YeartoDate(TempDate)*-1 as CurYTDFlag,

YeartoDate(TempDate,-1)*-1 as LastYTDFlag,

If(TempDate >= MonthStart(Today()) and TempDate <= Today(), 1, 0) as CurMTDFlag,

If(TempDate >= AddYears(MonthStart(Today()), -1) and TempDate <= AddYears(Today(), -1), 1, 0) as LastMTDFlag,

Here you can replace Today() with the variable that determines the max date in your data set.