Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

acbishop2
Contributor

Color by Alternative Measure

I have a bar graph that has one measure and two alternative measures. I want to be able to color each based on its own expression. Therefore, when I select the first measure, the bars should be colored based on their values. When I select the second (alternative) measure, the bars should be based off of their values. However, when I have the colors set to "By measure," it colors all measures by the values of the first one.

Please let me know if there is a way to work around this.

As always, thank you.

Aaron

1 Solution

Accepted Solutions
OmarBenSalem
Esteemed Contributor

Re: Color by Alternative Measure

Nope; it's the only way I can think of (and really think it's the only way)

for the space; u can use this filter :

https://github.com/countnazgul/Qlik-Sense-Styled-Lists-Extension

It take nearly no places + u can force it to be always selected (selection by default)+ force the user to select only One value

9 Replies
ogster1974
Honored Contributor II

Re: Color by Alternative Measure

Have you tried making your measures master items and setting the colours there?

Then in your chart use library colours instead of setting by measure.

Regards

Andy

xufei123
Valued Contributor

Re: Color by Alternative Measure

Not possible. This is an known limitation:

vanand3535
Contributor

Re: Color by Alternative Measure

we can take two dimensions, one main and another alternate dimension and take one measure.

set color by measure put expression:- in color by measure:-

if(CategoryName='Babywear','green',Yellow())

vanand3535
Contributor

Re: Color by Alternative Measure

sorry it will work when you use color by alternate dimension.

when you will select different different dimension then it will work accordingly

acbishop2
Contributor

Re: Color by Alternative Measure

This would work if the master items had a "color by expression" or a gradient feature. I want each of the alternative measures to be on a diverging color gradient.

Is there a way to write a color code that would change based on the measure that is selected? Like:

If({Selected Measure}=Alternative1, {ColorCode1}, If({Selected Measure}=Alternative2,{ColorCode2},etc)) ?

Obviously, this wouldn't work, but is there any way to do something similar?

OmarBenSalem
Esteemed Contributor

Re: Color by Alternative Measure

Let's assume u have 2 measures:

sum(Sales)

Sum(Production)

create an Inline table:

load * inline [

MeasureID,Measure

1, SalesMeasure

2, SalesProduction

];

iadd this new Measure field as a filter

in ur chart,

create a measure as follow:

if(MeasureID=1,sum(Sales),sum(Production))

and color by measure.

Now, u'll have sthing like this:

Capture.PNG

Capture.PNG

acbishop2
Contributor

Re: Color by Alternative Measure

This fulfills the purpose, but it takes up more space and is more complicated for the user. Is there any other way that you can think of that would do the same thing without having to include a filter box?

Thanks.

OmarBenSalem
Esteemed Contributor

Re: Color by Alternative Measure

Nope; it's the only way I can think of (and really think it's the only way)

for the space; u can use this filter :

https://github.com/countnazgul/Qlik-Sense-Styled-Lists-Extension

It take nearly no places + u can force it to be always selected (selection by default)+ force the user to select only One value

ogster1974
Honored Contributor II

Re: Color by Alternative Measure

Taking omarbensalem‌ solution you could make it a nicer layout by using a variable set by button extension i.e qsvariable.

See Makes Sense to go round in circles

Community Browser