Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Not applicable

Color Bar Chart dependent on Total Number of Bars

Hi everyone,

I have a little problem with Coloring my Bar Chart. I managed to show only my top and bottom 5 dimensions for my expression. This works fine. I also managed to color my top 5 green and my bottom 5 red.

Capture.PNG

The code for my dimension:

=aggr(  if(  rank(avg(<Expression>))<=5 or   rank(-avg(<Expression>))<=5  ,<Dimension>) ,<Dimension>)

The code for my color:

=If (Rank(avg(<Expression>)) <6, Red(), if (Rank(<Expression>)) > 5, Green()))

As stated above, this all works satisfying. My problem starts when the user selects something in one of the Listboxes and the total amount of rows is reduced to less than 10.

Capture.PNG

As you see, this are for of my best five rows from the Screenshot above. They are displayed in red because there are only 4 rows displayed in the Bar Chart. Therefore my question:

Do you know any possibility how to get a standard color like grey for my chart, if the total count of displayed rows in the chart is less than 10?

Something like RowNum(TOTAL) or NoOfRows did not work in that case.

1 Solution

Accepted Solutions
Not applicable

Re: Color Bar Chart dependent on Total Number of Bars

Thanks for your suggestion,

I tried your code, but it did not solve my problem. I still do not get the coloring I want. Perhaps there is no adequat solution to my problem and I have to think of something else to visualize. I appreciate your help, but I think, I will change my coloring to static values comparison.

6 Replies
MVP
MVP

Re: Color Bar Chart dependent on Total Number of Bars

what about a count distinct of the dimension?

or getpossiblecount

mov
Esteemed Contributor III

Re: Color Bar Chart dependent on Total Number of Bars

See if the attached example helps in your situation

Not applicable

Re: Color Bar Chart dependent on Total Number of Bars

Hi,

thank you for your help. The getpossiblecount function looks like it is working a lot of time in my case. My problem though is, that I have sometimes some dimensions without an expression value (expression value = null). Therefore my Bar Chart does not show those values, which is correct. But the getpossiblecount on this dimension of course includes those lines. So in that case I have just one row displayed but the getpossiblecount returns 49.

I would need either a way for getpossiblecount to exclude dimensions when an expression returns null or a way to count the displayed bars in my chart.

Not applicable

Re: Color Bar Chart dependent on Total Number of Bars

Hi,

thank you for your help. Unfortunatly I have to use the private Version at the moment and therefore I am not able to open your example.

mov
Esteemed Contributor III

Re: Color Bar Chart dependent on Total Number of Bars

Here is the color expression in my example.  The essential changes are in bold:

=only(aggr(If(Rank(total avg({1}Expression)) <3, Red(),if(Rank(total avg({1}Expression)) > 2, Green())),Dimension))

Not applicable

Re: Color Bar Chart dependent on Total Number of Bars

Thanks for your suggestion,

I tried your code, but it did not solve my problem. I still do not get the coloring I want. Perhaps there is no adequat solution to my problem and I have to think of something else to visualize. I appreciate your help, but I think, I will change my coloring to static values comparison.

Community Browser