Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Background Chart Expression Color using Set Analysis

Hi, Hope you all had a good Christmas and apologies if this is a simple question.

(Note - Example Attached)

I'm trying to use set analysis to set the rgb() of a chart expression background without much luck. Is this possible?

I've set up a 'Heat Map' table which I want to use to show additional percentage information on a chart. I'm using some simple set

analysis to reference the colour table although the results are not as expected.

The example QV QVW should hopefully explain a little better.

Many thanks

Richard

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

A set is calculated for an entire chart, not for a row of the chart.  The same is true of dollar sign expansion.  So your $(=sum(Value)) calculates the total value.  This total value is much higher than your table allows, so there are no RGB values to be found.  Even if it found one, it would apply the same value to every bar in the chart.

You'll want to do this without set analysis and without dollar sign expansion if you want a different color for every bar.

These seem to work, if I understood what you want.  There might be a simpler solution.

only(aggr(if(HeatMapId=sum(Value),
rgb(HeatMapRed,HeatMapGreen,HeatMapBlue)),HeatMapId,DateNum))

only(aggr(if(HeatMapId=round(sum(Value)/sum(total Value)*100/2),
rgb(HeatMapRed,HeatMapGreen,HeatMapBlue)),HeatMapId,DateNum))

View solution in original post

2 Replies
johnw
Champion III
Champion III

A set is calculated for an entire chart, not for a row of the chart.  The same is true of dollar sign expansion.  So your $(=sum(Value)) calculates the total value.  This total value is much higher than your table allows, so there are no RGB values to be found.  Even if it found one, it would apply the same value to every bar in the chart.

You'll want to do this without set analysis and without dollar sign expansion if you want a different color for every bar.

These seem to work, if I understood what you want.  There might be a simpler solution.

only(aggr(if(HeatMapId=sum(Value),
rgb(HeatMapRed,HeatMapGreen,HeatMapBlue)),HeatMapId,DateNum))

only(aggr(if(HeatMapId=round(sum(Value)/sum(total Value)*100/2),
rgb(HeatMapRed,HeatMapGreen,HeatMapBlue)),HeatMapId,DateNum))

Not applicable
Author

Thanks John,

I tried aggr() in an early test although I'm not too confident with that function yet so was unable to get it working. I thought I may and end with a ridiculous number of IF statements.

This works perfectly. Thanks for you support, hope you have a Happy New Year.

Richard