Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Filter multiple values in a column from filters selected

I have 2 tables. Table A is a dimension table having 2 columns, code and description. There are 8-10 codes in this table along with their descriptions.

CodeDescription
914940002Some text1
914940004Some text2

Table B is a fact table having multiple columns, one of which is code. Code column in Table B has rows with in the following format:

CodeDescription
914940002Some text1
914940002, 914940004Some text1, Some text2


and so on. I want to filter Table B by Table A such that when I click a Description from Table A (I will be using Table A as a filter slicer), it returns all the rows in Table B that contain that Description (in the above example, both rows will return as they both contain that description).

Please explain using Power Query or DAX how I can do this

  • Anonymous - Can you modify Table B? Or does it have to remain in that format? 
    If you can modify Table B, I would use power query to split the code column into rows. If you go into power query, and right click on the column table for code and click "Split Column" -> "By Delimiter" then select Comma. Then you can select advanced options, and split into new rows. 
    This will split your table and give each code line a unique row. 
    Then you can create a relationship between table A and table B on Code column, and your visualizations will filter as needed. 

6 Replies

  • Anonymous - Can you modify Table B? Or does it have to remain in that format? 
    If you can modify Table B, I would use power query to split the code column into rows. If you go into power query, and right click on the column table for code and click "Split Column" -> "By Delimiter" then select Comma. Then you can select advanced options, and split into new rows. 
    This will split your table and give each code line a unique row. 
    Then you can create a relationship between table A and table B on Code column, and your visualizations will filter as needed. 

    • Anonymous's avatar
      Anonymous
      Not applicable

      This works. Thank you!

  • @OsamaKamal 

    Mesure 8 =
    Var texte=selectedvalue(Table1[Description])
    var textfinal=SELECTEDVALUE('Table2'[Code])
    return
    if(CONTAINSSTRINGEXACT(textfinal,texte),1)
     
    And after you put this measure in your panel filter with value 1 and only rows with the selected text will be in
    • Anonymous's avatar
      Anonymous
      Not applicable

      Table 1 and Table 2 are A and B respectively ? As per the tables I shared