Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

nikitapuniani
New Contributor II

Qliksense server change color coding using expression

Hello Qliksense experts,

I am new to qliksense server and need some help on a scenario I am working on.

I am doing a bar chart comparison of sum(cost) on a dimension using set analysis.

Now I need to change the color scheme to blue and light grey.

Here is what I am trying to do but results are not working. Also please note that this is qliksenser server and the version is as of Sep 2017

---

I have created two measures

Measure1=sum({<RuleType='Existing'>}Cost)

Measure2=sum({<RuleType='New'>}Cost)


To change the color scheme I am applying the following expression that is not working


if(RuleType='Existing', lightgray(),blue())

Also tried if(RuleType='Existing', lightgrey(),if(RuleType='New',blue(),red()))

Can someone help me get the bar chart color to lightgrey for measure1 and blue for measure2 ?

Thanks,

Nikita



6 Replies
Khan_Mohammed
Honored Contributor II

Re: Qliksense server change color coding using expression

whts the dimension name here, RuleType?

sureshqv
Esteemed Contributor III

Re: Qliksense server change color coding using expression

is this measures working?

Measure1=sum({<[RuleType]={'Existing'}>}Cost)

Measure2=sum({<[RuleType]='New'}>}Cost)

then

if([RuleType]='Existing', lightgray(),blue())



or



If(Match([Rule Type],Exisitng), lightgrey(),blue())

Khan_Mohammed
Honored Contributor II

Re: Qliksense server change color coding using expression

I think there was a syntax error in your expression...

Use below expressions.

Exp1: sum({<RuleType={'Existing'}>} Cost)

Exp1: sum({<RuleType={'New'}>} Cost)

In appearances use below color code

if( RuleType='Existing', lightgray(),blue())

nikitapuniani
New Contributor II

Re: Qliksense server change color coding using expression

yes RuleType is a dimension having two values- new and existing

nikitapuniani
New Contributor II

Re: Qliksense server change color coding using expression

Shahbaz, Thanks !

Although thats not the issue. I have used if( RuleType='Existing', lightgray(),blue()) and it doesnt work

Not sure what the issue is. This is a server version

nikitapuniani
New Contributor II

Re: Qliksense server change color coding using expression

The issue has been resolved. The reason why it was not picking the color was because the dimension was a Drill down.

So I had to first create a dimension RuleType and then add drill down dimension.

The expression worked fine using the if clause as suggested.

This also eliminated the need to do the sum(measure) using set analysis.

Community Browser