Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Coming Aug. 9: New Simplified Authoring for Qlik Sense SaaS – For Details, CLICK HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
kathrine_spang
Contributor II
Contributor II

Setting date to first in a month

Hi,

I'm trying to set a variable so it's the first in the current month.

So today 2017-12-06 the variable should read 2017-12-01

I tried:

Let vFirstEveryMonth = Date (Year(Today())+Month(Today())+01,'YYYY-MM-DD hh:mm:ss');

Which returns: 1905-07-22 00:00:00

I assume since it just adds 2017+12+1=2030 which is the day 1905-07-22.


Thankful for any help

Kathrine

1 Solution

Accepted Solutions
richard_chilvers
Specialist
Specialist

.... I just tried MonthsStart(1, TODAY()) and it seems to work

View solution in original post

5 Replies
Anil_Babu_Samineni

May be this?

Let vFirstEveryMonth = Date(MonthStart(MakeDate(Year(Today()),Month(Today()),01)));

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
richard_chilvers
Specialist
Specialist

Hi

Have you tried using the MonthsStart function? It looks like it will do the kind of thing you want, with the correct parameters.

HTH

kathrine_spang
Contributor II
Contributor II
Author

Thank you!

I found the Monthstart function (waiting for moderation of the question) and it's acctually possible to just write:


Let vFirstEveryMonth= Monthstart (date(today()));

monthsstart - script and chart function ‒ Qlik Sense

Date format etc is allready specified earlier in the code.

richard_chilvers
Specialist
Specialist

.... I just tried MonthsStart(1, TODAY()) and it seems to work

richard_chilvers
Specialist
Specialist

Even better