Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Matching records and filter the data

Hi ,

 

I have two tables as shown below .

 

TableA:

 

number        Name

1                       a,b

2                       b,c

3                       a

4                       a,c

5                       b

6                       c

 

TableB:

number        Name

1                       a

2                       b

3                      c

 

Requirement is i had two tables as shown above, i have a slicer value from table  tableB . for example if i select name value a from tableB it needs to be filter a contain values need to be filter in tableA. please let me know the process.

               

Example : i have selected Value A from TableB

 

TableB

 

 

 

 

 

Than need to filter values in TableA as shown below .

 

TableA

Please let me know the process to achieve the result .

 

Thanking you in  advance .

 

Regards,

Srinivas.

 

 

 

  • Hi Anonymous ,

     

    Try this:

    Name Measure =
    IF (
        SEARCH ( SELECTEDVALUE ( TableB[Name] ), MAX ( TableA[Name] ),, BLANK () )
            <> BLANK (),
        MAX ( TableA[Name] )
    )
    

     

     

    Best Regards,

    Icey

     

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

9 Replies

  • Icey's avatar
    Icey
    Community Support

    Hi Anonymous ,

     

    Try this:

    Name Measure =
    IF (
        SEARCH ( SELECTEDVALUE ( TableB[Name] ), MAX ( TableA[Name] ),, BLANK () )
            <> BLANK (),
        MAX ( TableA[Name] )
    )
    

     

     

    Best Regards,

    Icey

     

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thank you  Icey , its worked for me .

       

      Regards,

      Srinivas.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi ,

       

      Thank you so much for your kind help , after filter the records i need to show the count(number of rows affected in table A) in card visualization .could you please help me on this .

       

      i was tried to showing the count but over all count only displaying in the visualization .filtered records rows count is not displaying.

       

       

      Regards,

      Srinivas.

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi Team ,

         

        Please help me in this .i am able to filter the rows as shaown above , but i am trying to show the filtered affected rows count in the card visualization but its showing overall count only not changing the as per the filter .

         

        Regards,

        Srinivas.

  • kentyler's avatar
    kentyler
    Solution Sage

    Live would be so much easier if you transform the first table before loading it into power bi

    numberName
    1a
    1b
    2b
    2      c
    3      a
    4a
    4      a
    5  b
    6 c

    Then you would not need to write ANY DAX code, a regular slicer would work fine.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi kentyler  ,

       

      Thank you for your response , i had amount column in that table . as said  if i split the name ,  that time  amount will be repeat multiple times and it is huge data with many columns . please let me know any other approach .

       

      Thank you .

       

      Regards,

      Srinivas.