Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
wnorwood
Contributor III
Contributor III

Variable for Chart Expression

Hello,

I have expressions that need to be reused in many charts in my application.  I would like to use a variable to do this.

The expression would look like this:

SUM({<REQUEST_CREATED_DATE={'>=$(vStartDate)'}, REQUEST_TICKET_TYPE={'Incidents'}>} TICKET_COUNT)

The problem is that the variable $(vStartDate) inside the expression is getting set to the date value (e.g. 1/1/2016) instead of the variable name.  I need the text in the expression to be exactly like the above so that $(vStartDate) will change as selections are made.

I have tried the following:

SET vVariable = SUM({<REQUEST_CREATED_DATE={'>=$(vStartDate)'}, REQUEST_TICKET_TYPE={'Incidents'}>} TICKET_COUNT);

SET vVariable = "SUM({<REQUEST_CREATED_DATE={'>=$(vStartDate)'}, REQUEST_TICKET_TYPE={'Incidents'}>} TICKET_COUNT)";

The result for both is

SUM({<REQUEST_CREATED_DATE={'>=1/1/2016'}, REQUEST_TICKET_TYPE={'Incidents'}>} TICKET_COUNT)

Does anyone have a solution for this?  Note that I cannot use macros.

Thanks.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

3 Replies
swuehl
MVP
MVP

Have a look at the suggested solutions here

Can I SET or LET a variable to include a $(=...)

sunny_talwar

Have you tried making changes to vStartDate cause I believe that the way it is structured the above expression should change with changes in vStartDate. Can you share a sample where this isn't happening?

wnorwood
Contributor III
Contributor III
Author

Thanks for the replies! One of the solutions in the link worked for me.  I had to use the SET the variable with a different character then replace the character in a LET solution since I had single quotes in my text.  Thanks again!