Skip to main content
Announcements
Announcing Qlik Talend® Cloud and Qlik Answers™ to accelerate AI adoption! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Referring to current field in set analysis

I'm trying to build an expression in a bar chart where I want to calculate the difference between today's values and yesterday's. I'm using a date dimension called period. So I thought I could write something like this:

sum(value) - sum({<period = {period -1}>}value)


...but then I get an "Error in set modifier ad hoc element list" error.


Any ideas on what the problem is and how to solve it are very welcome.


Thanks,

Uzi

3 Replies
nilesh_gangurde
Partner - Specialist
Partner - Specialist

sum({<period = {"=$(date(today()))"}>}value) - sum({<period = {"=$(date(today() - 1))"}>}value) 


Assuming that period field is in Date format. if not make it the same format as Date.


-Nilesh

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

You cannot use a set expression related to the dimension value. The expression is evaluated outside of the context of the dimensions. Use Above() to compare a value with previous value in chart. This should do the trick:

     Sum(Value) - Above(Sum(Value))

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Hi Uzi

just a metter of syntax

sum({<period = {"=$(period -1)"}>}value)

in this case period is selected value.  To change it as today

sum({<period = {"=$(today()-1)"}>}value)

you can also set a variable in your script or parameters as vToday = today(),   vYesterday = today()-1

best regards

Chris