Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

compare PERIOD with text

Hi all,

I try to compare period with text, so I try to conver date that I make from MAKEDATE function to num (because [Period] return in number although it show in Text like Nov-2008).

But it return num from date not period.

[Period]={">=$(=NUM(DATE(MAKEDATE(CONT_START_YEAR,CONT_START_MONTH),'MMM-YYYY'))) and <=$(=NUM(DATE(ADDMONTHS(MAKEDATE(CONT_START_YEAR,CONT_START_MONTH),6),'MMM-YYYY')))"}

Thank you so much



7 Replies
vidyut
Partner - Creator II
Partner - Creator II

Try using the Text() Function instead of Num().

Not applicable
Author

Many thanks Vidyut Verma

But [Period] return in number, so it cannot match text with it.

When I test in text object return like >>>

[Period]={">=Nov-2008 and <=Dec 2008"}

What I try to do is >>>>

[Period]={">=192830 and <=2948924"}

Thank you so much

sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi

use this

[Period]={">=$(=(DATE(MAKEDATE(CONT_START_YEAR,CONT_START_MONTH),'MMM-YYYY'))) and <=$(=(DATE(ADDMONTHS(MAKEDATE(CONT_START_YEAR,CONT_START_MONTH),6),'MMM-YYYY')))"}

-Sathish

Not applicable
Author

Thank you so much Sathish

It still doesn't work becase I test in text object and the return is >>>

[Period] = {">= Nov-2008 and Dec-2008"}

although DATE() function return in number. (I don't know why Huh? )

This case will be correct if it return number of PERIOD

or any suggestion?

--- Thanks you so much ----

sathishkumar_go
Partner - Specialist
Partner - Specialist

Hi

do 1 thing just use this

DATE(MAKEDATE(CONT_START_YEAR,CONT_START_MONTH),'MMM-YYYY') as Month1

in load statement(script part) after put listbox in month1.

check month1 is number or date format?

-Sathish

Not applicable
Author

Thank you so much Sathish

It's number but it show in date format.

And PERIOD can use = to compare

But cannot use >= or <=

Many thanks

Not applicable
Author

Hi all,

I'hv got a way for this solution.

Thank you so much for your help.