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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pie chart - calculated color only for one value

Hi community! 🙂

Please help me with expression for pie chart color. I have questionare with few questions and one pie chart to show them one by one using this expression to choose dimension (question):

=$(=subfield(GetFieldSelections([Question_number]),',',))

Each question has different number and type of possible answers, but all has one common - 'Others'.

For example I'm using this for pie popout: =$(=subfield(GetFieldSelections([Question_number]),',',))='Others'

And now I want to use something similar for set color of that 'Others', but not of the rest.

Somthing like this? if($(=subfield(GetFieldSelections([Question_number]),',',))='Others', RGB(255,0,0),Rand)

13 Replies
Not applicable
Author

Great, it is simple and works absolutely how I want to. THANKS 😉

Not applicable
Author

OK, one more thing. In some cases there is same color for these answers in else part of

if($(=subfield(GetFieldSelections([Question_number]),',',))='Others',RGB(255,0,), Color(100*Rand()))

Is it possible to use random, but unique value?

tresesco
MVP
MVP

Try multiplying Rand() by 10 instead of 100.

=Color(10*Rand()))

Not applicable
Author

That doesn't help. I've also tried this:

if($(=subfield(GetFieldSelections([Question_number]),',',))='Others',RGB(255,0,99), RGB((700*Rand()),(999*Rand()),(500*Rand())))

but again, in some cases there are some colors duplicated.

My temporary solution is sort values(answers) by:

if($(=subfield(GetFieldSelections([Question_number]),',',))='Others',1)

so 'Others' is always first and I can set color in color tab...