Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
bertrand01
Contributor III
Contributor III

Graph Dimension with []

Hi everybody,

I have the dimension of a graph in a variable vTimeLevel.

In most case, this dimension is the name of a field from a calendar.
Because the field name can contain '-', like mois-année, I need to put it between  [] : [$(vTimeLevel)]

But in some other case the value of vTimeLevel is not a field, but a variable :  ='if([%KeyDate] >= $(=max(%KeyDate))-7, Date)'

So it does not work either for the dimension case or the variable case.

I've tried all the things I could think of but it doesn't work.
Any idea how I can solve this?

Thanks in advance,

 

Labels (1)
4 Replies
vinieme12
Champion III
Champion III

calculated dimensions need to be wrapped in AGGR()   as below

also remove single quotes from the expression

vTimeLevel  =  if([%KeyDate] >= $(=max(%KeyDate))-7, Date)

Dimension = 

 AGGR ( vTimeLevel  , %KeyDate ) 

OR 

AGGR ($( vTimeLevel)  , %KeyDate ) 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
bertrand01
Contributor III
Contributor III
Author

Thanks for your reply,

That doesn't solve my problem as when I click on the month button for example to agregate by month, then vTimeLevel=Month-Year Field from the calendar and will not work without brakets.

If I put [vTimeLevel] as dimension then it will work for [Month-Year] field not when I click on last 7 days button : the [vTimeLevel] dimension will be [if([%KeyDate] >= $(=max(%KeyDate))-7, Date)] and will not work...

barnabyd
Partner - Creator III
Partner - Creator III

G'day @bertrand01, this is a curious problem.

Is it possible to include the square brackets in the value of the variable? For example ...

vTimeLevel = '[mois-année]';

When you paste $(vTimeLevel) into the column, it will already include the brackets.

Cheers, Barnaby.

Barnaby Dunn
BI Consultant
bertrand01
Contributor III
Contributor III
Author

Thanks Barnabyd,

Sorry that I dont expose my problem clearly :
There's buttons affecting the value of the variable vTimeLevel :

It can be for example :

vTimeLevel = [Année] (Year)

vTimeLevel = [Mois-Année] (Year-Month)

vTimeLevel = if([%KeyDate] >= $(=max(%KeyDate))-7, Date)

In my graphs, I have 2 choices for using the dimension :
=vTimeLevel or =[vTimeLevel]

If I use =vTimeLevel, Mois-Année does not work and just shows -Année value (-Year)

If I use =[vTimeLevel], if([%KeyDate] >= $(=max(%KeyDate))-7, Date) does not work as it doesn't understand the [].