Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, I want to have the same of 24 industry groups to be displayed in the same color across charts. I realized that this can be done if I just use the same color expression in the different charts. However, for this purpose anyway, it seems Qliksense does not have a "case" or "switch" syntax and I need to compose 23 nested if statements. Here is what I have and it works, so non-urgent but if someone knows of a better way please let me know:
if([GICS Industry Group] = 'Automobiles & Components',red(),
if([GICS Industry Group] = 'Banks',blue(),
if([GICS Industry Group] = 'Capital Goods',black(),
if([GICS Industry Group] = 'Commercial & Professional Services',DarkGray(),
if([GICS Industry Group] = 'Consumer Durables & Apparel',LightBlue(),
if([GICS Industry Group] = 'Consumer Services',rgb(255,218,185),
if([GICS Industry Group] = 'Diversified Financials',green(),
if([GICS Industry Group] = 'Energy',lightGreen(),
if([GICS Industry Group] = 'Food & Staples Retailing',Cyan(),
if([GICS Industry Group] = 'Food Beverage & Tobacco',rgb(255,165,0),
if([GICS Industry Group] = 'Health Care Equipment & Services',rgb(192,192,192),
if([GICS Industry Group] = 'Household & Personal Products',rgb(255,105,180),
if([GICS Industry Group] = 'Insurance',rgb(192,192,192),
if([GICS Industry Group] = 'Materials',LightGray(),
if([GICS Industry Group] = 'Media',rgb(176,196,222),
if([GICS Industry Group] = 'Pharmaceuticals Biotechnology & Life Sciences',rgb(0,0,0),
if([GICS Industry Group] = 'Real Estate',rgb(255,20,147),
if([GICS Industry Group] = 'Retailing',yellow(),
if([GICS Industry Group] = 'Semiconductors & Semiconductor Equipment',rgb(255,0,255),
if([GICS Industry Group] = 'Software & Services',rgb(186,85,211),
if([GICS Industry Group] = 'Technology Hardware & Equipment',rgb(75,0,130),
if([GICS Industry Group] = 'Telecommunication Services',magenta(),
if([GICS Industry Group] = 'Transportation',lightRed(),
rgb(255,0,255))))))))))))))))))))))))
Alternatives:
1) You can do a Pick( Match ( ..... )) like this:
Pick( Match( [GICS Industry Group] ,
'Automobiles & Components',
'Banks',
.....
) ,
Red(), Blue(), .....
)
2) Let the associative model in Qlik do the work for you by having a separate table with key value pairs where the key is [GICS Industry Group] and just keep the key also in the main table.
Alternatives:
1) You can do a Pick( Match ( ..... )) like this:
Pick( Match( [GICS Industry Group] ,
'Automobiles & Components',
'Banks',
.....
) ,
Red(), Blue(), .....
)
2) Let the associative model in Qlik do the work for you by having a separate table with key value pairs where the key is [GICS Industry Group] and just keep the key also in the main table.
Hi - it may not be of any use and a bit of an amateur tip but for me I create master items and place those into the various visuals. Each master item has a selectable colour, which allows me to theme the same measure throughout the app.
Create a master dimension and assign colors: Dimension Colors