Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

use monthstart function

Not applicable
Author


try this:


MakeDate(Year, Month, 1) as Date

Anonymous
Not applicable
Author

MonthStart(YearMonth) as Date?

it's working incorrectly

sunny_talwar

Try this in the front end:

=Date(MakeDate(Year(Date#(YearMonth, 'YYYYMM')), Month(Date#(YearMonth, 'YYYYMM')), 1), 'DD.MM.YYYY')

or this in the back end:


Date(MakeDate(Year(Date#(YearMonth, 'YYYYMM')), Month(Date#(YearMonth, 'YYYYMM')), 1), 'DD.MM.YYYY') as Date

sasiparupudi1
Master III
Master III

=Date(monthstart(date#(YearMonth,'YYYYMM')),'DD.MM.YYYY')

Anonymous
Not applicable
Author

use makedate function

MK_QSL
MVP
MVP

=MonthStart(Date#(YourMonthYearField,'YYYYMM'))

Anonymous
Not applicable
Author

Thank you!!!

Could you please write me, how to write flags:

1. YTD (from beginning of current year till max yera month)

2. PriorYTD (The same as YTD, but for prior year)

3. MTD (get max YearMonth)

4. PriorMTD (The same as MTD, but for prior year)

sunny_talwar

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,