Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
GROM
Contributor
Contributor

Multiple conditions for colour formatting

Hi guys,

I'm trying to do some conditional colour formatting for a table. While I can do a basic 'If,then,else' condition, I'm looking for something a bit more complex.

In the image I have attached, I want the columns showing percentages to display in the following manner:

  • Points related to REVENUE: positive - blue, negative - red;
  • Points related to EXPENSES: positive - red, negative - blue;

Should I try to nested IF statements with the NIVEL 1 and then select the points manually (ex. Nivel 1 - 1. Ventas,etc), or Set Analysis.

I'm a bit lost to be honest, so any help would be appreciated.

Thanks in advance.

qlik.png

1 Solution

Accepted Solutions
AndrewHughes
Partner
Partner

It sounds like the issue is the color should be applied to records flagged Expense differently than those flagged Revenue.

First I would create a flag RecordType with values 'Revenue', 'Expense'.

Then I would use it in your if statement. Something like this.

If(Flag.RecordType = 'Revenue', $(vNested1), IF(Flag.RecordType = 'Expense', $(vNested2), YELLOW())

vNested = If(Value > 0 , BLUE, RED)

vNested = if(Values<0, BLUE, RED)

View solution in original post

3 Replies
AndrewHughes
Partner
Partner

It sounds like the issue is the color should be applied to records flagged Expense differently than those flagged Revenue.

First I would create a flag RecordType with values 'Revenue', 'Expense'.

Then I would use it in your if statement. Something like this.

If(Flag.RecordType = 'Revenue', $(vNested1), IF(Flag.RecordType = 'Expense', $(vNested2), YELLOW())

vNested = If(Value > 0 , BLUE, RED)

vNested = if(Values<0, BLUE, RED)

View solution in original post

GROM
Contributor
Contributor
Author

Thanks for your answer Andrew.

However, and please correct me if I'm wrong, FLAGs can only be defined in the loading script, which we don't have access to. 

The idea was to try this myself before asking our Qlik partner to do it. Oh well 😛

AndrewHughes
Partner
Partner

If that is the case, it is possible to create a very large if statement with each field manually listed; however, it is advisable to do this in the script so that the developer can for example just join color RED to Expenses and color Blue to Revenues. This way going forward as new accounts are added they are automatically colored.