7 Replies Latest reply: Nov 18, 2014 3:24 AM by Ravi Balar RSS

    Conditionally Display Labels on Chart

    Mike Swinn

      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.

        • Re: Conditionally Display Labels on Chart
          Sudeep Mahapatra

          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.

          • Re: Conditionally Display Labels on Chart
            Michael Solomovich

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

            • Re: Conditionally Display Labels on Chart
              Sundarakumar Kalaimani

              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

              • Re: Conditionally Display Labels on Chart
                Mike Swinn

                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.