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

Pie chart colors when using set analysis

I have a pie chart that shows test results by three Risk Levels (High, Intermediate, and Optimal) for a particular physician.  Then I have another pie chart that uses set analysis to show test results for the same three Risk Levels, but for all physicians located in the same state as the selected physician.  In other words, I’m comparing one physician’s Risk Levels against all the other physicians in that state.  This is working fine.  The problem is, I would like the pie slices in both charts to be specific colors (High = Red, Intermediate = Yellow, Optimal = Green, default = Gray).  I have the background color definition set to use the selected Risk Level value to set the color, and that works fine most of the time. However, if the selected physician does not have data for one of the Risk Levels, the second pie chart’s slice for that group gets the default color rather than the color it should get.  I realize this is because that Risk Level is now excluded, since the selected physician doesn’t have any data for it. But obviously, the second pie has some way to distinguish the dimensions correctly, based on the set analysis expression.  When there is data for that Risk Level for some physician in the state, the chart correctly displays the data and the Risk Level name in the legend.  How can I get all the pie slices in the second chart to be the correct colors?  What field or setting do I need to use in the background color expression, or is there another way?  Setting the colors to match on the two pies is very important to my users.  Please see the attached app.  Any ideas on this are greatly appreciated!

1 Solution

Accepted Solutions
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi there,

You need to put set analysis into your colour expression (as well as the expression that is driving the data for the pie) so that the colour will show correctly regardless of selections made.

In your case this means replacing the variable v_rangeSelected with:

maxstring({1}RiskLevel)

Hope that helps,

Steve

View solution in original post

3 Replies
stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi there,

You need to put set analysis into your colour expression (as well as the expression that is driving the data for the pie) so that the colour will show correctly regardless of selections made.

In your case this means replacing the variable v_rangeSelected with:

maxstring({1}RiskLevel)

Hope that helps,

Steve

Not applicable
Author

Thanks so much, Steve, that worked.  I knew it was something to do with putting set analysis in there, but I didn't know how to do it--I'm still new to Qlikview.  I really appreciate the help!!!

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

No problems, it is always a pleasure to be able to help out on the forums.