Forum Discussion

mahirk81's avatar
mahirk81
Icon for Microsoft Employee rankMicrosoft Employee
6 years ago
Solved

show/hide an Image based on Slicer selection

Hi All,

 

Can we show/hide an Image based on Slicer selection in PowerBI?
Example : I will update the Image in PowerBI and when I select the slicer as Yes, then the Image should show and If it is No, then Images should hide.
 
Is it possilble?
 
Thanks,
Mahi
  • Hi, mahirk81 


    You may create a table like below.

    New:

     

    Then you may modify the measure as below.

    Visual control = 
    IF(
        SELECTEDVALUE(New[IsDisplay])="Yes",
        1,
        IF(
            SELECTEDVALUE(New[IsDisplay])="No",
            0
        )
    )

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • v-alq-msft's avatar
    v-alq-msft
    Icon for Community Support rankCommunity Support

    Hi, mahirk81 


    You may create a table like below.

    New:

     

    Then you may modify the measure as below.

    Visual control = 
    IF(
        SELECTEDVALUE(New[IsDisplay])="Yes",
        1,
        IF(
            SELECTEDVALUE(New[IsDisplay])="No",
            0
        )
    )

     

    Result:

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • v-alq-msft's avatar
    v-alq-msft
    Icon for Community Support rankCommunity Support

    Hi, mahirk81 

     

    Based on your description, I created data to reproduce your scenario.

    Table:

    Test(a calculated table):

    Test = DISTINCT('Table'[ID])

     

    You need to set data category for 'Image url' as Image URL.

     

    Then you may create a measure as beolw.

    Visual control = 
    IF(
        ISFILTERED('Test'[ID]),
        IF(
            SELECTEDVALUE('Table'[ID]) in FILTERS('Test'[ID]),
            1,0
        ),
        0
    )
    

     

    Finally you may put the measure in the visual level filter and use the 'ID' column from 'Test' to filter the result.

     

    Best Regards

    Allan

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

    • Syndicate_Admin's avatar
      Syndicate_Admin
      Icon for Administrator rankAdministrator

      Very good solution, however the image does not appear, I get this, what can it be due to?