Cognos Analytics

 View Only
  • 1.  How to hide chart when there is no data available

    Posted Thu February 17, 2022 07:05 AM
    How to hide charts on the page when there is no available data. Using count distinct measure, and having no data content set to yes still returns empty charts.

    ------------------------------
    Veljko
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: How to hide chart when there is no data available

    Posted Thu February 17, 2022 07:59 AM
    Hi Veljko,

    do you use a visualization or a chart?

    If it's a chart you can set the setting for "No data contents" to "No content"


    If it's a visualization I recommend creating a Boolean variable which returns Yes/No based on the measure you use. Then set this variable for your vis and select that it should only be rendered when the result of the variable is "Yes".


    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ
    Ingelfingen
    ------------------------------



  • 3.  RE: How to hide chart when there is no data available

    Posted Thu February 17, 2022 08:42 AM
    Hi Robert,

    Thank you for your replay. I am using chart, and Yes, I have already set the setting for "No data contents" to "No content" but it still shows empty chart.  

    ------------------------------
    Veljko
    ------------------------------



  • 4.  RE: How to hide chart when there is no data available

    Posted Thu February 17, 2022 09:06 AM
    Edited by System Test Fri January 20, 2023 04:31 PM
    Hi Veljko,

    what kind of data do you use in the chart and of which aggregation rule is it? Keep in mind that e.g. count(distinct) returns a 0 when there's no hit in the data and therefore the charts gets that 0 and displays an empty looking chart graph.

    Another option would be to check suppression. Did you activate it?

    If this all doesn't help you can still try the solution via the Boolean Variable and create a conditional block. Set up the variable for the block so it gets to contents (Yes & No) and place the chart into the "Yes" content" and nothing into the "No" content.

    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ
    Ingelfingen
    ------------------------------



  • 5.  RE: How to hide chart when there is no data available

    Posted Thu February 17, 2022 09:19 AM
    Yes, I am using count distinction. I will defiantly will go now with Variable. I was trying to escape this solution since I have several charts on one page, using different count distinct measure, so I will now probably have to create several variables.

    Thank you for help

    ------------------------------
    Veljko
    ------------------------------



  • 6.  RE: How to hide chart when there is no data available

    Posted Thu February 17, 2022 09:24 AM
    And waht about the suppression? I guess the chart is rendered because it gets a zero which is not suppressed accordingly.

    You can define what should be suppressed and when:
    A quick solution is to activate the suppression on the query level:


    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ
    Ingelfingen
    ------------------------------



  • 7.  RE: How to hide chart when there is no data available

    Posted Thu February 17, 2022 03:59 PM
    Hi Veljko,

    can it be that the cart is not really empty though? What kind of values and of which aggregation rule do you use in the chart? Have you applied (zero-)suppression on the chart?

    Keep in mind that e.g. count (distinct xxx) returns a 0 when theres no hit in the data. Then this 0 is data for the chart and therefore it will be displayed. Just my thought which might be the case here.

    Nevertheless you can still use the variable as a solution. There's an object called "conditional block" where you can define this variable to used by the block. The block will then have one block content for No and another for Yes. "Yes" gets the chart and "No" gets nothin.

    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ
    Ingelfingen
    ------------------------------



  • 8.  RE: How to hide chart when there is no data available

    Posted Fri February 18, 2022 04:40 AM
    Hi Veljko,

    @Robert Dostal is right about conditional block.

    You need to create a Dummy calculation in your queries, it will use the following expression:
    ​count([Any column from your queries])

    Drag your visualization into conditional block. One conditional block for each visualization.
    Add a boolean block variable in each conditional block.
    The report expression for the variable will be:
    [Query1].[Dummy] is not null 
    For another visualization, it would be [Query2].[Dummy] is not null 

    The structure should look like:

    Drag your visualization in the varData = Yes. If you have multiple queries, you will need to create varData2, varData3 and so on.

    On each varData (and 2, 3,...) = No, be sure to change the following parameters:
    In Box, Box type = None
    In Positionning, Visible = No

    If you have a list or crosstab container, be sure to update the following (located in General)

    Best regards,

    ------------------------------
    Patrick Neveu
    Positive Thinking Company
    ------------------------------