Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
samuel_lin
Contributor

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
Partner
Partner

Re: Using Set Variable in Set Analysis Qlik Sense

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



samuel_lin
Contributor

Re: Using Set Variable in Set Analysis Qlik Sense

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
New Contributor III

Re: Using Set Variable in Set Analysis Qlik Sense

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
Contributor

Re: Using Set Variable in Set Analysis Qlik Sense

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
Honored Contributor

Re: Using Set Variable in Set Analysis Qlik Sense

Hi Samuel,

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

Regards,

Andrey