Forum Discussion

EugenioProlog's avatar
EugenioProlog
Icon for Helper III rankHelper III
1 year ago
Solved

How do I Hide columns based on metric?

I have this Cohort on a matrix table that has Columns that vary according to a column on one of my tables. I want it to display only values that are not null. Is there a way to do that?   I...
  • Demert's avatar
    1 year ago

    Hi EugenioProlog ,

     

    You can simply filter out the blanks in your filter pane by doing this:

    This will not work for Cohort % because you always return 0 in the measure.

     

    To fix this i suggest the following code 

    Cohort % = 
    VAR Numerador = 
        CALCULATE(
            [Subscriptions], 
            FILTER(
                client_base,
                client_base[lifetime_months] >= SELECTEDVALUE(Lifetime[Lifetime])
            )
        )
    VAR Denominador = [Subscriptions]
    
    RETURN 
    if (ISBLANK(Numerador),BLANK(),
       0+ DIVIDE(Numerador, Denominador, 0) ) // Retorna 0 se o denominador for 0)

    And then also filter out the blanks for this measure out in your filter pane.