Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
samuel_lin
Creator
Creator

Using Set Variable in Set Analysis Qlik Sense

Hello Qlikers,

I have two tables, for simplicity:

Events:

EmailAddress

EventName

EventStartDate

EventEndDate

Transaction:

EmailAddress

OrderDate

Revenue

In my script I have these two lines:

Set vEventEndDate = Date(EventEndDate);

Set vEventStartDate = Date(EventStartDate);

In the table I want to calculate things such as

count({<OrderDate={'>$(vEventEndDate)}>} distinct EmailAddress), I got invalid expression, ad I have tried several way to add $ signs, but still no luck.

Could someone please guide me?

Thanks,

Samuel

5 Replies
OmarBenSalem

count({<OrderDate={">$(vEventEndDate)"}>} distinct EmailAddress)



samuel_lin
Creator
Creator
Author

Hi Omar,

Thank you for your help, but this didn't work for me.

Just for testing, In Qliksense, when I create a straight table with Event as a dimension, and got null when adding [$(vEventEndDate)] as dimension. Thoughts? Am I wrong using set in the script?

duffman1968
Contributor III
Contributor III

Hey Samuel,

When I was struggling with the syntax of set analysis I found this link to be helpful:

http://tools.qlikblog.at/SetAnalysisWizard/QlikView-SetAnalysis_Wizard_and_Generator.aspx

I learned a lot from that site.

Hope it helps you!

Regards,

Pat

samuel_lin
Creator
Creator
Author

For straight table, I have such as:

Event        EventEndDate

Event1      9/15/2016

Event2      11/12/2016

where EventEndDate is a dimension of $(vEventEndDate), this shows up okay, meaning the variable is working using set from the script

Now I want to have a table

Event             count(customer after event date)

Event1          150

Event2          139

where, for event1, it's evaluated as count({<OrderDate={'>9/15/2016'}>} distinct EmailAddress)

but event2 is evaluated as count({<OrderDate={'>11/12/2016'}>} distinct EmailAddress)

specific to its event end date, any thought?

ahaahaaha
Partner - Master
Partner - Master

Hi Samuel,

Can we see a full fragment of data (with all need fields)?

Regards,

Andrey