Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ssims2017
Contributor II
Contributor II

Date Function Help

If feel like I'm missing something obvious...

I have 2 different dates in April 2019

What might be the reason that this returns TRUE:  MonthEnd(Date1) = MonthEnd(Date2)

And this returns FALSE:  InMonth(MonthEnd(Date1), MonthEnd(Date2), 0)

 

And in troubleshooting, I found that this returns TRUE: InMonth('04/30/2019', MonthEnd(Date2), 0)

And this returns FALSE: InMonth('04/30/2019', MonthEnd(Date1), 0)

1 Solution

Accepted Solutions
JustinDallas
Specialist III
Specialist III

InMonth wants a Timestamp as it's first argument.  So with this as my script:

 

DATA2:
LOAD 
Date(Date#(TestDateText1,'MM/DD/YYYY')) AS 'TestDate1',
Date(Date#(TestDateText2,'MM/DD/YYYY')) AS 'TestDate2'
;
LOAD * Inline
[
 TestDateText1, TestDateText2
 '04/23/2019', '04/30/2019'
]
;
EXIT Script
;

 

 

And this as my KPI formula, 

 

InMonth(DayStart(MonthEnd(TestDate1)), MonthEnd(TestDate2), 0)

 

 

I get this:

Timestamp2.png

 

So I think it's the Timestamp parameter that's causing you issues.

https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/Da...

View solution in original post

3 Replies
JustinDallas
Specialist III
Specialist III

InMonth wants a Timestamp as it's first argument.  So with this as my script:

 

DATA2:
LOAD 
Date(Date#(TestDateText1,'MM/DD/YYYY')) AS 'TestDate1',
Date(Date#(TestDateText2,'MM/DD/YYYY')) AS 'TestDate2'
;
LOAD * Inline
[
 TestDateText1, TestDateText2
 '04/23/2019', '04/30/2019'
]
;
EXIT Script
;

 

 

And this as my KPI formula, 

 

InMonth(DayStart(MonthEnd(TestDate1)), MonthEnd(TestDate2), 0)

 

 

I get this:

Timestamp2.png

 

So I think it's the Timestamp parameter that's causing you issues.

https://help.qlik.com/en-US/qlikview/November2018/Subsystems/Client/Content/QV_QlikView/Scripting/Da...

arpitkharkia
Creator III
Creator III

May be issue with format of Date1?

ssims2017
Contributor II
Contributor II
Author

Thank you.  Date# on the Date1 field did the trick.