Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ivanyang25
Contributor III
Contributor III

How to put color (with expression) in drill down dimension?

Dear Qlik Sense Experts

I am new to Qlik Sense and I am a front end user

I have created a drill down dimension as below which I group ‘Product’ into 3 types: ‘A’, ‘B’, ‘C’


1.PNG

I already put color with expression for A1/A2/A3/A4/B1/B2/B3/B4/C. But how can I put color for A & B as well?

I want to put color for the upper layout (A/B/C) and lower layout (A1/A2/A3/A4/B1/B2/B3/B4/C) at the same time so that user can see color before or after they drill down on this pie

Is it possible to do so in Qlik Sense? If so, how to make it happen?

Thank you for your advice in advance

2.PNG


1 Solution

Accepted Solutions
rubenmarin

Hi Ivan, still can be done as:

if (Product='NewRelease',RGB (106,191,74),

if (Product='Aged NoPSD',RGB (226,35,26),

if (Product='M1M2 Make',RGB (255,106,0),

if (Product='M1M2 Fail',RGB (62,141,221),

if (Product='OverAllFail M3',RGB (233,107,175),

if (Product='OverAllFail M1M2',RGB (111,113,112),

if (Product='Overall Make',RGB (74,192,224),

if (Match(MinString(Product), 'Aged NoPSD', 'NewRelease', 'M1M2 Make', 'M1M2 Fail'), blue(),

if (Match(MinString(Product)='OverAllFail M1M2', 'OverAllFail M3'), yellow()

)))))))))

Another option can be to create a new field in script called [Product Group] (or similar), so the hierarchy has two levels: [Product Group] and [Product]. Then you have real values to select and apply colors using the real values for each level.

View solution in original post

14 Replies
ogster1974
Partner - Master II
Partner - Master II

If you are using the latest version of sense you can set colour of dimensions of you have it as a master item.  perhaps look at that.

ivanyang25
Contributor III
Contributor III
Author

Andy

Thanks for the reply. I try but it doesn't work out

Ivan

rubenmarin

Hi Ivan, that's happening because A and B have many different colors if it ended with none, you need to tell wich color use when 'A' or 'B'.

One option can be using "MinString(Product)" instead of "Product".

Or wich color do you want to assign to 'A' or 'B'?

ivanyang25
Contributor III
Contributor III
Author

Ruben

Thank you so much for your reply

Could you try to write down the expression base on this case so that I could do test in my apps?

Should I simply add MinString(Product) into below expression?

捕获.PNG

For question 2, I would like to put red color on 'A' and yellow on 'B'

Ivan

ivanyang25
Contributor III
Contributor III
Author

Ruben

I use 'MinString(Product)' instead of 'Product' and it works, but I still have questions

1. I don't know why it works even after I check the function of 'MinString'. Can you help explain a little bit that why it works on this way?

2. Color of A is same as A1, so does B

3. What should I do if I want to put different color on 'A' & 'B'? I try to add expression as below but it doesn't work

3.PNG

1.PNG

2.PNG

Thank you for your advise in advance


Ivan

rubenmarin

Hi Ivan,

1. MinString gets the first value sorted alphabetically, so it gets A1 for A, and B1 for B.

2. It was an example that it works when it has only one color to choose, but when it has more than one it will show grey.

3. By your screenshots seems that product 'A' and 'B', doesn't exists, they are created using a calculated dimension.

You can try with an expression like:

// Your initial script without MinString

If(Product='A1', RGB(),

If(Product='A2', RGB(),

...

If(Product='C', RGB(),

// At the end add the colors for synthetic values, using Left() to get the first character

If(Left(MinString(Product), 1)='A', Yellow(),

  If(Left(MinString(Product), 1)='B', RGB()

...

ivanyang25
Contributor III
Contributor III
Author

Ruben

Thank you so much for your detailed explanation

I try to use Left in script but it still doesn't work

Don't know which part is wrong in it.

捕获.PNG

Ivan

rubenmarin

Hi Ivan, I'm not sure why is not working, I upload your sample modified.

rubenmarin

Ok, now I see, the 'real' products (A1, A2, ... C) should be without Minstring()