Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis Date Range issue

Hi,

My expressions

count({<CREATED_DT= {"=>$(vSt_Date)"}>}DISTINCT(S_CODE))  as well as

count({<CREATED_DT= {">=$(vSt_Date)"}>}DISTINCT(S_CODE))

gives 0, but expression

count({<CREATED_DT= {"=$(vSt_Date)"}>}DISTINCT(S_CODE))

gives the count matching to CREATED_DT

What could be the issue in my first 2 expressions where in I want to get the count >= the date.

Thanks

Lax

9 Replies
alexandros17
Partner - Champion III
Partner - Champion III

The right one is >=, however try writing

count({<CREATED_DT= {">=01/01/2014"}>}DISTINCT(S_CODE)) and verify the result (obviously set your date), I think that the problem is date format of the variable

Not applicable
Author

Hi,

Had it been date format issue then my second expression should have also failed.'

count({<CREATED_DT= {"=$(vSt_Date)"}>}DISTINCT(S_CODE)) gives the proper count matching the date.

CREATED_DT is in DD-MM-YYYY and vSt_Date is a variable with value as 06-03-2014

PrashantSangle

Hi,

You made a very small mistake

Count({<CREATED_DT= {"=>$(vSt_Date)"}>}DISTINCT(S_CODE))

instead of this

You have to write

Count({<CREATED_DT= {">=$(=vSt_Date)"}>}DISTINCT(S_CODE))

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
alexandros17
Partner - Champion III
Partner - Champion III

The question is that syntax is correct, I should use ' instead of " but everything is ok

Please try

count({<CREATED_DT= {'=$(vSt_Date)'}>}DISTINCT S_CODE)


or


count({<CREATED_DT= {'=$(=vSt_Date)'}>}DISTINCT S_CODE)

Not applicable
Author

Hi,

Just to verify the date format issue...I have to get the following code to equate the dates.

if(Date#(CREATED_DT,'DD-MM-YYYY') >= Date#('06-03-2014','DD-MM-YYYY'),1,0)

above code works when dates are formatted. How do I handle this in the set expressions ??

Not applicable
Author

try below

count({<CREATED_DT= {"=>$(=Date(vSt_Date,'MM/DD/YYYY'))"}>}DISTINCT(S_CODE))

SunilChauhan
Champion II
Champion II

make sure your  CREATED_DT should be Number format

Num(CREATED_DT) as CREATED_DT_num


calculate max on the basis of CREATED_DT_num


then use your  expression same

hope this helps

Sunil Chauhan
PrashantSangle

Hi,

Actually there is no need to convert but if you want you can convert at script level

as following

Date#(CREATED_DT,'DD-MM-YYYY') as CREATED_DT

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable
Author

This worked

count({<CREATED_DT= {">=$(=Date#(vSt_Date,'DD-MM-YYYY'))"}>}DISTINCT(S_CODE))


Thanks

Lax