Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Color code based on Group

Hi,

I have created 2 bar charts where the dimension for first chart is "Level1_Name" and dimension for second chart is "Level2_Name"

with some expressions.

Now I need to have color coding consistent in both the charts for example in Level1_Name = 'A' is Red then Level2_Name i.e. 1-A, 2-A, 3-AA, 4-AAA should have Red,

if Level1_Name  = 'B' is in Green Color then Level2_Name i.e 5-BB, 6-BB, 7-B, 8-B should be in green Color. please suggest me how to achieve this

ID Level1 _Name Level2_Name
1 A 1-A
2 A 2-A
3 A 3-AA
4 A 4-AAA
5 B 5-BB
6 B 6-BB
7 B 7-B
8 B 8-B
7 Replies
PrashantSangle

Hi,

If this is dimension then click on + symbol of that dimenion

You will see font color write expression in that

like

if(wildmatch(level1_Name,'A',Red(),if(wildmatch(level1_Name,'B',Green()))))

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
its_anandrjs

Hi,

If you are using it as dimension or expression then click on Plus sign

and in background write

=if(Match([Level1 _Name],'A'),Green(),Red())

And in

Text Color write

White()

BAQckcolor.png

I believe you get this output

Colorcode.png

Regards

Anand

Anonymous
Not applicable
Author

Hi Savi,

try below in the background color property in your expressions:

=pick(WildMatch(Level1_Name, 'A', 'B'), Green(), Red(), Yellow())

=pick(WildMatch(Level2_Name, 'A', 'B'), Green(), Red(), Yellow())

Regards

Neetha

Not applicable
Author

Hi,

thank u so much for the suggestions, but hardcoding is not allowed in my project, is there any way to get this dynamically without hardcoding values....

agomes1971
Specialist II
Specialist II

Hi,

sorry but if don´t have it on your data model or on your ETL then it will be a difficult task...

Regards

André Gomes

its_anandrjs

Hi,

Possible but you have to done changes in the load script and create a single Inline table for colors and then use in the front end.

Regards

Anand

Anonymous
Not applicable
Author