Forum Discussion

dura's avatar
dura
Regular Visitor
3 years ago
Solved

Filter by two values

Dear Community, 

 

I have the following data:

The values 1,2,3,4 in the column language are connected to languages. The NULL value has no language e.g is nummeric or just doesn't need translation and needs to be visible in all languages.  Therefore I need to filter the data by tuples e.g (NULL, 1), (NULL , 2), (NULL, 3), (NULL, 4). 

 

How can I do this? I would love a filter which would just look like this:

 

 

Thanks. 

  • Hi , dura 

    According to your description, do you mean you want to use the [Languages] as a slicer to filter the table , like that when you select "2" , you will show “2” and "NULL".

    If this , here are teh steps you can refer to :
    (1)This is my test data :

    For your need , you do not need to create any relationship between two tables.

     

    (2)Then we can create a measure :

    Measure = var _slicer=  VALUES('Languages'[Languages])
    var _cur_lan = MAX('Table'[Language])
    return
    IF(_cur_lan=BLANK() || _cur_lan in _slicer , 1 , 0)

     

    (3)Then we can put the measure on the "Filter on thsi visual" and configure it like this :

     

     

     

     

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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

     

1 Reply

  • Hi , dura 

    According to your description, do you mean you want to use the [Languages] as a slicer to filter the table , like that when you select "2" , you will show “2” and "NULL".

    If this , here are teh steps you can refer to :
    (1)This is my test data :

    For your need , you do not need to create any relationship between two tables.

     

    (2)Then we can create a measure :

    Measure = var _slicer=  VALUES('Languages'[Languages])
    var _cur_lan = MAX('Table'[Language])
    return
    IF(_cur_lan=BLANK() || _cur_lan in _slicer , 1 , 0)

     

    (3)Then we can put the measure on the "Filter on thsi visual" and configure it like this :

     

     

     

     

    If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

    Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

     

    Best Regards,

    Aniya Zhang

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