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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Applying background colors to cycliic group dimensions

Hi,

I have a requirement wherein i need to build a chart with a cyclic group having the dimensions Status and Priority wherein i need Status to have a background color as

 

If([Status]='S1', RGB(229, 182, 148), //brown
If([Status]='S2', RGB(65, 167, 70), //Green
If([Status]='S3', RGB(80, 160, 240), //Blue
If([Status]='S4', RGB(255, 217, 47), //
If([Status]='S5, RGB(171, 233, 198),
If([Status]='S6', RGB(221, 66, 66), //Cyan
If([Status]='S6', ARGB(90, 255, 0,0),
)))))))

The priorities in the chart to have a background color as

If(only({1}[ Priority])='Priority-1', ARGB(255, 255, 0, 0),
   
If(only({1}[ Priority])='Priority-2', RGB(255, 217, 47),
   
If(only({1}[ Priority])='Priority-3', RGB(80, 160, 240),
   
If(only({1}[ Priority])='Priority-4', RGB(187, 216, 84),))))

So now that I have two dimensions it is not possible to put them in the expressions tab.Please let me know how this could be done.

5 Replies
Anonymous
Not applicable
Author

Yes you can do it,

firstly use getcurrentfield([Group Name]) function

ie,

if(getcurrentfield([Group Name])='Status',

If([Status]='S1', RGB(229, 182, 148), //brown

If([Status]='S2', RGB(65, 167, 70), //Green

If([Status]='S3', RGB(80, 160, 240), //Blue

If([Status]='S4', RGB(255, 217, 47), //

If([Status]='S5, RGB(171, 233, 198),

If([Status]='S6', RGB(221, 66, 66), //Cyan

If([Status]='S6', ARGB(90, 255, 0,0),

))))))),


If(only({1}[ Priority])='Priority-1', ARGB(255, 255, 0, 0),
   
If(only({1}[ Priority])='Priority-2', RGB(255, 217, 47),
   
If(only({1}[ Priority])='Priority-3', RGB(80, 160, 240),
   
If(only({1}[ Priority])='Priority-4', RGB(187, 216, 84),))))


)

hope this will help you out

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It's easier than it looks. You can use the group name as the field name in the test. For example if your group name is "MyGroup"

=If([MyGroup]='S1', RGB(229, 182, 148), //brown

If([MyGroup]='S2', RGB(65, 167, 70), //Green

If([MyGroup]='Priority-1', ARGB(255, 255, 0, 0),

If([MyGroup]='Priority-2', RGB(255, 217, 47)

))))

I'm not sure why you were using the only() function in your previous example.

-Rob

http://robwunderlich.com

Not applicable
Author

This works for me and is a simpler expression. Thanks Rob.

Not applicable
Author

Hi Rob,

Incase there are no values for a particular condition the color coding would fail i mean incase the function returns null values the color coding would thus only was used in the exp

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Go ahead and mark my answer correct to close the thread if it answers your group question.

Rob