Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
chaper
Creator III
Creator III

Dynamic color based Current Status ??

Color JPEg.PNG

Need help

I am trying create field/expression to get overall Status Color for item based on Stage. If any stage has black color get color from previous stage as Overall color for that item.So For C Overall status color should be Amber as Stage Status for 3&4 are Black and For item B Overall Status color should be Green as Stage Status is Black fro Stage 4 is black.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Even easier. Remove the if statement and the last branch:

FirstSortedValue({<[Stage Status]-={'Black'}>}total <Item> Color, -Stage)


talk is cheap, supply exceeds demand

View solution in original post

7 Replies
Gysbert_Wassenaar

See attached example.


talk is cheap, supply exceeds demand
sunny_talwar

Didn't know RGB worked in the script to create a color field. Thanks for this Gysbert

Gysbert_Wassenaar

RGB() is just a 'convenience' function to create a big number. A number that happens to be something that can be used to tell the software to render something in a certain color.


talk is cheap, supply exceeds demand
chaper
Creator III
Creator III
Author

Thanks for reply Gysbert. Your background color expression works great if I want to show stage color of previous stage if it current stage is black .But I am looking for something like below.Overall Stage Status color should be latest Stage Color if it not black.For example item A has yellow for last stage 4 so overall Color for Stage should be yellow .For item B Stage 4 is black so go to previous Stage which is 3 and its color is green so overall color of stage should be Green.

thanks for your help

Color JPEg.PNG

Gysbert_Wassenaar

Even easier. Remove the if statement and the last branch:

FirstSortedValue({<[Stage Status]-={'Black'}>}total <Item> Color, -Stage)


talk is cheap, supply exceeds demand
chaper
Creator III
Creator III
Author

I was about to reply that it worked if I remove If condition. .And you go it right .Many thanks Gysbert.

chaper
Creator III
Creator III
Author

Hey Gysbert.Will it work only on expression not on dimensions?When I applied same logic to large data set it is not working .It does not work with FirstSortedValue({<[Stage Status]-={'Black'}>}total <Item> Color, -Stage) but it works with if([Stage Status]='Black',FirstSortedValue({<[Stage Status]-={'Black'}>}total <Item> Color, -Stage),Color) but the other way like below

Color JPEg.PNG