Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ali_hijazi
Partner - Master II
Partner - Master II

Get the dimension value

Hello

I got a pie chart with Dimension = Counry, and Expression = Sum(Sales)

I want the color the parts of the pie depending on the name of the country

I got 7 countries

in the colors tab I want to write something if Country = X , Red(), if(Country = Y, Green(),...

Please advise

I can walk on water when it freezes
1 Solution

Accepted Solutions
Gysbert_Wassenaar

You can use an expression like pick(Match(Country,'X','Y', ...),red(),green() ...) to match colors with countries. Or you could add a color table to your load script like explained here.


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
swuehl
MVP
MVP

Try using a background color attribute expression in expression tab (open attributes by clicking  on the plus sign next to your expression).

ali_hijazi
Partner - Master II
Partner - Master II
Author

Ok but how do I know the value of the country?

I can walk on water when it freezes
swuehl
MVP
MVP

Try just as you already proposed:

if(Country = 'A', rgb()...

Gysbert_Wassenaar

You can use an expression like pick(Match(Country,'X','Y', ...),red(),green() ...) to match colors with countries. Or you could add a color table to your load script like explained here.


talk is cheap, supply exceeds demand
ali_hijazi
Partner - Master II
Partner - Master II
Author

ok one more thing

the dimension that I have is actually a cyclic group

I'm using now GetCurrentField to see if the cyclic group is now grouping by country and I used your suggestion above

now if the group is not by country I want to reuse the default colors that the pie chart usually show

in fact now i'm getting Black if I change the group to other than Country

Please advise

I can walk on water when it freezes