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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Complex Nesteed IFs - garbage after expression

Hello,

I need to have this 3 satements to define the colour of my bares, but I'm getting the fllowing error "garbage after expression"

My code is the following:

IF(A = 0,(IF(FIELD=1, RGB(34, 156, 228),IF(FIELD=2, RGB(0, 0, 0), IF(FIELD=3, RGB(34, 156, 228),IF(FIELD=4, RGB(0, 0, 0),IF(FIELD=5, RGB(34, 156, 228),IF(FIELD=6, RGB(0, 0, 0)))))))))

//

=IF(A= 1,

  only({<FIELD={1}>} RGB(120,120,120)),

  IF(A=2,

  only({<FIELD={2)>} RGB(120,120,120)),

  IF(A= 3,

  only({<FIELD={3} RGB(120,120,120))));

  =IF(A2=4,

  only({<FIELD={4}>} RGB(120,120,120)),

  IF(A2=5,

  only({<FIELD={"<=5"}>} RGB(120,120,120)),

  IF(A2=6,

      only({<FIELD={"<=6)"}>} RGB(120,120,120))

  )));

Can anybody help me?

11 Replies
sunny_talwar

Not sure if you are showing two expressions or they are two alternatives, but try this may be:

IF(A = 0,

IF(Match(FIELD, 1, 3, 5), RGB(34, 156, 228),

IF(Match(FIELD, 2, 4, 6), RGB(0, 0, 0))))

Not applicable
Author

Hi Sunny T

Yes I'm trying with 3 expressions. let me test your code

Not applicable
Author

Your code Sunny_T saves the 1ªpart of my problem... but when I need to have:

=IF(A= 1,

  only({<FIELD={1}>} RGB(120,120,120)),

  IF(A=2,

  only({<FIELD={2)>} RGB(120,120,120)),

  IF(A= 3,

  only({<FIELD={3} RGB(120,120,120))));

  =IF(A2=4,

  only({<FIELD={4}>} RGB(120,120,120)),

  IF(A2=5,

  only({<FIELD={"<=5"}>} RGB(120,120,120)),

  IF(A2=6,

      only({<FIELD={"<=6)"}>} RGB(120,120,120))

  )));

I will have the same problem

sunny_talwar

I am not sure what exactly are you trying to do. Why are there two expressions here?

Not applicable
Author

Basically:

- I have two slicers to influence the colour of my chart;

- If the the slicer (A) = 0 then all the colours but be like you write in first answer.
- IF the slicer (A) = 1 then the first bar should have a specific colour
- IF the slicer (A) = 2 then the first and second bar should have a specific colour
- IF the slicer (A) = 3 then the first and second and third bar should have a specific colour

- IF the slicer (A2) = 4 then the fourth bar should have a specific colour

- IF the slicer (A2) = 5 then the fourth  and fifth and second bar should have a specific colour
- IF the slicer (A2) = 6 then the fourth  and fifth and sixth and second and third bar should have a specific colour

swuehl
MVP
MVP

Won't these slider interfere in defining e.g. color for second bar?

Not applicable
Author

I've One dimension with 6 labels:

Slicer A: Influences colour of Label 1,2,3
Slicer A2: Influences colour of Label 4,5,6

MarcoWedel

can you post a sample application to test with?

Not applicable
Author

Here you have