Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
uacg0009
Partner - Specialist
Partner - Specialist

Question about date in set analyst with variable

Hi All,

I have data :

Date Set Analyst.JPG

And I have a variable = today()

I just want to calculate that count(id) before the variable(today).

I want to make it using set analyst not if else.

So I try to use =Count({<DATE={"<=Variable1"}>}ID), but it shows 0.

I think it's a easy request, but i don't know why, maybe it's because of type.

Could you please help?

Thanks.

Aiolos Zhao

1 Solution

Accepted Solutions
sunny_talwar

Try this:

=Count({<delivery_date={"<=$(=Date($(Variable1), 'YYYY-MM-DD'))"}>}id)


Capture.PNG

UPDATE: I think the issue is related to the formatting here. vVarable1 is in number format and in order for set analysis to work, it needs to be converted to a very specific date format -> YYYY-MM-DD which matches the date format for delivery_date. Read more about dates in set analysis here: Dates in Set Analysis

View solution in original post

12 Replies
tamilarasu
Champion
Champion

Aiolos,

You missed to add $ Symbol. Try like below,

=Count({<DATE={"<=$(Variable1)"}>}ID)

PrashantSangle

Hi,

try like

Count({<DATE={"<=$(Variable1)"}>}ID)

or

Count({<DATE={"<=$(=Variable1)"}>}ID)


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 🙂
sujeetsingh
Master III
Master III

go through the document provided by Qlik on set analysis.

Set Analysis: syntaxes, examples

qlikview979
Specialist
Specialist

Hi,

Try like this

Count({<DATE={"<=$(Variable1)"}>}ID)

uacg0009
Partner - Specialist
Partner - Specialist
Author

Thanks for reply, but could you please see my new attached, it's a little strange for my example, I don't know why.

Thanks.

Aiolos Zhao !

uacg0009
Partner - Specialist
Partner - Specialist
Author

Thanks for reply, but could you please see my new attached, it's a little strange for my example, I don't know why.

Thanks.

Aiolos Zhao

uacg0009
Partner - Specialist
Partner - Specialist
Author

Thanks for reply, but could you please see my new attached, it's a little strange for my example, I don't know why.

Thanks.

Aiolos Zhao

uacg0009
Partner - Specialist
Partner - Specialist
Author

Thanks for reply, but could you please see my new attached, it's a little strange for my example, I don't know why.

Thanks.

Aiolos Zhao

sunny_talwar

Try this:

=Count({<delivery_date={"<=$(=Date($(Variable1), 'YYYY-MM-DD'))"}>}id)


Capture.PNG

UPDATE: I think the issue is related to the formatting here. vVarable1 is in number format and in order for set analysis to work, it needs to be converted to a very specific date format -> YYYY-MM-DD which matches the date format for delivery_date. Read more about dates in set analysis here: Dates in Set Analysis