Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

rvijayanth
New Contributor III

Help in writing an expression

What is wrong in the following expression?

In a table, I'm trying to show my dimension "Year" only for the years where it is greater than a variable where is the user is setting. Variable name is vLimit.

{<[Year] = {">$(vLimit)"}>}

I'm getting an invalid dimension error. What is wrong with this syntax? Please help

7 Replies
craigsutton
Contributor

Re: Help in writing an expression

Are you trying to do a calculated dimension or modify your expression with set analysis? If you are modifying your expression then what does your full expression look like?

MVP
MVP

Re: Help in writing an expression

May be like this

Sum({<[Year] = {">$(=vLimit)"}>}Measure)

rvijayanth
New Contributor III

Re: Help in writing an expression

This is what I'm using now. But here is my issue:

Lets say I have data since 2005. By default, in a table, we display data for the last 5 years. We pass a variable in the measure to show only the sum for past five years. Users can click a button to change the variable which will then display data for all years (since 2005). Everything is good so far.

But when the table opens by default, users are allowed to select a year which is, lets say 2006, (which is outside of last 5 years). For this selection, the table is not showing data since the measure is trying to calculate sum for for last 5 years and the user selection for year is 2006.

So I want to somehow only show past 5 years in "year" selection in table and show all years to select ONLY when the users click in "All Years" button.

rvijayanth
New Contributor III

Re: Help in writing an expression

Lets say I have data since 2005. By default, in a table, we display data for the last 5 years. We pass a variable in the measure to show only the sum for past five years. Users can click a button to change the variable which will then display data for all years (since 2005). Everything is good so far.

But when the table opens by default, users are allowed to select a year which is, lets say 2006, (which is outside of last 5 years). For this selection, the table is not showing data since the measure is trying to calculate sum for for last 5 years and the user selection for year is 2006.

So I want to somehow only show past 5 years in "year" selection in table and show all years to select ONLY when the users click in "All Years" button.

rahulpawarb
Valued Contributor II

Re: Help in writing an expression

May be this.

Regards!

Rahul

rvijayanth
New Contributor III

Re: Help in writing an expression

Im talking about qliksense app. How do I convert this to QlikSense?'

Can you just show the dimension and measure expression?

rahulpawarb
Valued Contributor II

Re: Help in writing an expression

Hello Vijayanth,

I used QlikView actions from button click i.e. Action Type = Selection & Action = Select in Field for field CalendarYear with Search String ='>=' & vLimit.

Regards!

Rahul