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

Bar chart min/max

In my bar chart I would like to show the max and min Amound in different colours, somehow this works in year 2012 YTD only but not in the other 2 years. Can anyone tell me what is wrong with my formula? Would be great if anyone could help.

if(GetSelectedCount(Periode)=1,

if(sum([Kurzfristige Überschusshöhe])<= min(TOTAL [Kurzfristige Überschusshöhe]),Lightred(),

if(sum([Kurzfristige Überschusshöhe])>= max(TOTAL [Kurzfristige Überschusshöhe]),Green(),

if((Periode=2011 and sum([Kurzfristige Überschusshöhe])> min(TOTAL([Kurzfristige Überschusshöhe]))), LightGray (),
if((Periode=2011 and sum([Kurzfristige Überschusshöhe])< max(TOTAL([Kurzfristige Überschusshöhe]))), LightGray (),

if((Periode='2012 HR' and sum([Kurzfristige Überschusshöhe])> min(TOTAL([Kurzfristige Überschusshöhe]))),Black (),
if((Periode='2012 HR' and sum([Kurzfristige Überschusshöhe])< max(TOTAL([Kurzfristige Überschusshöhe]))),Black (),

if((Periode='2012 YTD' and sum([Kurzfristige Überschusshöhe])> min(TOTAL([Kurzfristige Überschusshöhe]))),Black (),
if((Periode='2012 YTD' and sum([Kurzfristige Überschusshöhe])< max(TOTAL([Kurzfristige Überschusshöhe]))),Black ())))))))))

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Hi,

if I understand your request correctly, I think one issue is that you need to aggregate the kurzfr. Überschusshöhe prior to finding the min/max. You can do this using advanced aggregation, maybe along these lines

if(GetSelectedCount(Periode)=1,

if(sum([Kurzfristige Überschusshöhe])<= min(total<Periode> aggr( sum([Kurzfristige Überschusshöhe]),Periode,Versicherungsnehmer))+0.1, Lightred(),

if(sum([Kurzfristige Überschusshöhe])>= max(total<Periode> aggr( sum([Kurzfristige Überschusshöhe]),Periode,Versicherungsnehmer))-0.1, Green(),

LightGray()

)))

I needed to add small numbers (could be even much smaller, like the smallest amount that could be represented), since QV seemed to have problems with comparing the floating point values on at least one minimum value (Comparing floating point values is always an issue, I assumed it should work here since the calculations are essentially identical, but I was wrong).

See also attached.

Regards,

Stefan

View solution in original post

2 Replies
swuehl
MVP
MVP

Hi,

if I understand your request correctly, I think one issue is that you need to aggregate the kurzfr. Überschusshöhe prior to finding the min/max. You can do this using advanced aggregation, maybe along these lines

if(GetSelectedCount(Periode)=1,

if(sum([Kurzfristige Überschusshöhe])<= min(total<Periode> aggr( sum([Kurzfristige Überschusshöhe]),Periode,Versicherungsnehmer))+0.1, Lightred(),

if(sum([Kurzfristige Überschusshöhe])>= max(total<Periode> aggr( sum([Kurzfristige Überschusshöhe]),Periode,Versicherungsnehmer))-0.1, Green(),

LightGray()

)))

I needed to add small numbers (could be even much smaller, like the smallest amount that could be represented), since QV seemed to have problems with comparing the floating point values on at least one minimum value (Comparing floating point values is always an issue, I assumed it should work here since the calculations are essentially identical, but I was wrong).

See also attached.

Regards,

Stefan

Not applicable
Author

Hi Stefan,

That's it! First time in two days I have a big smile on my face in front of QV.

Regards

Nicole