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

Conditionally Display Labels on Chart

I have various charts with grouped dimensions which can be cycled through. For example in many, the time dimension can be cycled between year, month or day.

I would like to have labels display on the chart itself when only a few values are present (less than 10 for example). This would depend both on the data range selected, and the granularity selected (the dimension being used), e.g. one quarter at month granularity would have 3 data points, just as 3 years at year level would. I would like to set the label visible only when up to 10 values are displayed.

Is this possible in QlikView? In Tableau there was no option to directly conditionally hide or display labels, but the labels themself could be any dimension or a calculated expression, so I could effectively do what I want with a condition expression along the lines of:

if(rowcount() <=10 then value [else nothing])     -- (not real code obviously)


However in QV I can only see the option to label the points with their own value itself, and there appears to be no conditional option.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

show value should return true/false; use this

=if(GetPossibleCount(Time) <=2 , 1, 0)

from online help

Show Value

Click on Show Value in order to enter an attribute expression for calculating whether the data point plot should be complemented with a "value on data point" value, even if Values on Data Points has not been selected for the main expression. If Values on Data Points is selected for the main expression the attribute expression will be disregarded. This type of attribute expression only has effect on bar, line and combo charts. 

View solution in original post

7 Replies
sudeepkm
Specialist III
Specialist III

QlikView has built in function (getPossibleCount()) using which you can identify the number of possible values present in a field as per your selection. So you can use it while displaying the label.

If you could post a sample QVW then I may try using the function in it.

Anonymous
Not applicable
Author

Why not?  Label, including label in group, can be expression.  Just give it a try.

sundarakumar
Specialist II
Specialist II

Getcurrentfield(drilldown_name) will work fine(but it will show it red underlined)...

Use the above function to find the granularity it is in and then set the condition with another if statement..

This can be done..

-Sundar

Not applicable
Author

All suggestions are helpful thanks; the GetPossibleCount() on the time dimension should do what I'm after. GetCurentFeild() is also new to me and while it'll be useful in some cases, GetPossibleCount is more powerful here as it means I can show or hide the labels based on both the selected dimension and the filters I have applied, rather than always showng or always hiding based on the dimension.

However, I may have been confusing the terminology here - it's not the chart label up the top I'm interested in effecting, rather the individual labels at the top of the bars. When I use GetPossibleCount(Time), where Time is my cyclical dimension, it works fine on the label but not on the value labels which I set with the 'Show Value' expression attribute. Oddly, these seem to show the value regardless of what I put in there, even if I set their expression to something completely unrelated such as "=2", they still show the value itself.

See attached example. I want the values above each bar to display when there are 2 or fewer bars, and be hidden otherwise.

maxgro
MVP
MVP

show value should return true/false; use this

=if(GetPossibleCount(Time) <=2 , 1, 0)

from online help

Show Value

Click on Show Value in order to enter an attribute expression for calculating whether the data point plot should be complemented with a "value on data point" value, even if Values on Data Points has not been selected for the main expression. If Values on Data Points is selected for the main expression the attribute expression will be disregarded. This type of attribute expression only has effect on bar, line and combo charts. 

Not applicable
Author

Didn't realise it was boolean. Now works perfectly, thanks.

Not applicable
Author

Hi,

Is it possible in scatter chart?

Because for that we have checkbox so.