coder_bg
coder_bg

Reputation: 370

Hide a visual until slicers are selected in power BI

I want to display values on the table visual only when 3 of the slicers are selected or else no values should be displayed. For this, I did :

IF(ISFILTERED(Table[Country]),IF(ISFILTERED(Table[Procurement Team]),IF(ISFILTERED(Table[Class]),1,0),0),0)

Then in the Filters panel I put this measure and did "is" 1. This means when the slicers are selected, i.e. TRUE then the values will be showed however this is working fine till procurement team selection but as soon as I am selecting class , the values in the table get populated. I am unable to understand why. Can anyone help me with this?

Upvotes: 1

Views: 2708

Answers (1)

sergiom
sergiom

Reputation: 4887

I think the problem is that you are using some of the fields inside the visual. Removing the filter context created by the visual might be a possible solution. To achieve this, use ALLSELECTEDand CALCULATE

ToShow =
CALCULATE(
    IF(
        ISFILTERED( 'Table'[Country] ),
        IF(
            ISFILTERED( 'Table'[Procurement Team] ),
            IF( ISFILTERED( 'Table'[Class] ), 1, 0 ),
            0
        ),
        0
    ),
    ALLSELECTED( 'Table' )
)

and then you can implement your measures testing the [ToShow] like for instance

Sum Value =
IF( [ToShow] = 1, SUM( 'Table'[Value] ) )

Upvotes: 0

Related Questions