Forum Discussion

sugra's avatar
sugra
Icon for Helper I rankHelper I
6 years ago
Solved

Hide data in power bi visual until a filter was selected.

Good day,   I followed this post on hiding data in power bi unless a filter was selected.  https://community.powerbi.com/t5/Desktop/How-can-I-hide-data-from-populating-Visuals-until-I-filter-it-in...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Hi sugra 

    Due to I don’t know your data model, and the result you want to get, I create a sample to have a test.

    I build Table_1 in SQL Sever and get data in DirectQuery model.

    Table_1:

    Then I try your way:

     

    QuestionSelectCheck2 =
    
    IF(HASONEFILTER('Table_1'[X]),1,2)

     

    Drag the measure into Filters on this visual and select 1.

    Result is as below:

    Select a:

    My result is correct.

    If you still can’t use this way in DirectQuery, you can try my way.

     

    Measure =
    
    IF(ISFILTERED(Table_1[X]),1,BLANK())

     

    OR

     

    Measure =
    
    IF(HASONEFILTER(Table_1[X]),1,BLANK())

     

    NOTE: We need to keep all rows the same as below.

    Result :

    Select a:

    If we use ISFILTERED we can make complex select:

    If this reply still can’t help you solve your problem, please provide me your data source, the visual of the result you want or the visual of the problem.

    You can download the pbix file form this link:

    https://qiuyunus-my.sharepoint.com/:u:/g/personal/tongzhou_qiuyunus_onmicrosoft_com/ES7Mp3eFL9JKgs6uREkFhvUBXNsVP3NdjgnWdAT9Ku_z6g?e=wmRNsT

     

    Best Regards,

    Rico Zhou

     

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