Forum Discussion

psorel's avatar
psorel
Icon for Helper I rankHelper I
2 years ago
Solved

restrict the data in a filter visual from one table with data present only in another table

I have a dimension table containing all the states present in my Power BI, and in other tables I have different states. I would like to use the state column of the dimension table to create a visual filter but by restricting the data visible in the filter to the data present in my second table. Can I put a measure that would allow me to do this?

Use State filter with 8 states but when i use the filter i only see A,C,D,E,F.
THANKS.

 

 

 

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi  psorel ,

    Are you referring to using [ID] data from another table to affect the [ID] in the dimension table as a slicer

     

    Here are the steps you can follow:

    1. Create measure.

    Flag =
    var _select=SELECTCOLUMNS('Table1',"id",'Table1'[ID])
    return
    IF(
        MAX('dimension table'[ID]) in _select,1,0)

    2. Place [Flag]in Filters, set is=1, apply filter.

    3. Result:

     

     

    Best Regards,

    Liu Yang

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

3 Replies

  • PijushRoy's avatar
    PijushRoy
    Icon for Community Champion rankCommunity Champion

    Hi psorel 

    Please create a relationship with State between both table with both way filter



    Let me know if that works for you


    If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

    Thanks
    Pijush
    Linkedin

  • hi PijushRoy , 
    I have an error message telling me that the filter path between the tables of a data model is authorized. and I need to disable relationships between tables. I use the dimension  table for several tables using the same column as relation field.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  psorel ,

    Are you referring to using [ID] data from another table to affect the [ID] in the dimension table as a slicer

     

    Here are the steps you can follow:

    1. Create measure.

    Flag =
    var _select=SELECTCOLUMNS('Table1',"id",'Table1'[ID])
    return
    IF(
        MAX('dimension table'[ID]) in _select,1,0)

    2. Place [Flag]in Filters, set is=1, apply filter.

    3. Result:

     

     

    Best Regards,

    Liu Yang

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