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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
herard_bertrand
Partner - Creator II
Partner - Creator II

How to set a Dimension with a formula in a line Chart / Colors / By dimension ?

Hello,
In Qlik Cloud in a Line Chart in Appearance / Colors and Legend / By Dimension
there is a button to use a formula to set the Dimension (please note i'm talking about By Dimension and NOT By Expression).
Does someone knows what is the syntax to set the Dimension ?

For example, I want to write something like this :
=if([layout.switch_dim.field]=1,Brand,Site)

where Brand and Site are Dimensions in Master Measures (and not fields).

I don't manage to write it

Thanks

 

Labels (2)
3 Replies
brunobertels
Master
Master

hi 

may be try  

AGRR(

if([layout.switch_dim.field]=1,Brand,Site), Brand,Site)

anat
Master
Master

try like below

if(GetFieldSelections([layout.switch_dim.field])=1,Brand,Site)

herard_bertrand
Partner - Creator II
Partner - Creator II
Author

Hello,

thanks for your suggestions ;), that's correct but I forgot to precise :
=> I want to write a formula that will return an existing dimension (not a calculted one).

Details : 
We are in the color / by dimension part, and I'd like to use an existing dimension there, because I set customs colors on it ( in master measure).
Remark 1 : 
By the way, if I use a field with color result in by dimension such as rgb(244,12,10), it will correctly set the color of the graph BUT will display rgb(244,12,10) in Legend 🙂 .
Remark 2: Before you suggest it, If I use Color by expression, first I don't want custom colors on all field values, 2) the legend disapears with expression
Regards