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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
nilaB
Contributor II
Contributor II

Color coding a bar chart with aggregated measures

Dear all,

i want to color code my bar chart in a way that will make it look similar to a boxplot. 

May data (very simplified) looks like this:

Load * Inline [

G, Attribute,Key, Value,

1,a,'01',10

1,b,'01',4

2,a,'01',7

2,b,'01',11]

There are two bars, one for the min and one for the max value, which will be stacked on top of each other. I want to color the min value white and the max value blue (so that it looks like the picture).

The min and max (e.g. max-min) are calculated from an aggregation:

          min(aggr(sum({state1 <key={'01'}>}value),G,key))

          max(aggr(sum({state1 <key={'01'}>}value),G,key))

So min should be 14 and max  18.

I already found this link to 'fake' a dimension: https://community.qlik.com/t5/Documents/Qlik-Sense-How-to-set-custom-colors-by-measure-in-a-bar-char...

Without the  aggregation this works perfectly fine. But if i put an aggregation in the if statement only the first gets calculated.

 

Does anybody know how else i could color code the bar chart. The only thing i defintely can't do is make another table in the load statement with the aggregated values, because i still need to be able to filter the attributes.

Thank you very much in advance!!

Labels (1)
1 Solution

Accepted Solutions
OmarBenSalem

Create your measures as Master Elements and color them :

Capture.PNG

Now, create a bar chart, with a dimension like "valueliste('min max')

and use your 2 master measures , result :

Capture.PNG

View solution in original post

3 Replies
OmarBenSalem

Create your measures as Master Elements and color them :

Capture.PNG

Now, create a bar chart, with a dimension like "valueliste('min max')

and use your 2 master measures , result :

Capture.PNG

nilaB
Contributor II
Contributor II
Author

Hey, 

i looks a little bit different in my qlik sense. But i tried to do that.

nilaB_0-1620293823201.png

and 

nilaB_1-1620293894894.png

 

But the bar chart doesn't use the segment color...

nilaB_2-1620293916800.png

 

Do you know why?

 

 

nilaB
Contributor II
Contributor II
Author

Hey,

i just updated to the February 2021 release and now it looks the same and also works for me! 
Thank you very much!!!