Forum Discussion

David_'s avatar
David_
New Member
4 years ago
Solved

Referencing a column based on values in another column

Hi, I'm trying to tell which column I want to look in table b based on values in a column in table a. The column in table A have 1, 2, 3, 4 in them and table B have columns named 1, 2, 3, 4

In excel id use something like index/match but i can't wrap my head around what to do in DAX.
Below you can see what I'm kinda trying to do.

Column =
var _var1 = 'Table_A'[Column_1]
var _var2 = "'Table_B'[" & _var1 & "]"
return
RELATED(_var2)

Hope someone has some good input. Thanks in advance!
  • David_ 

    It dies not work this way with DAX. you need first to unpivot your table using power quert then you column names will become values in the Attributes column. Then filtering will be simple

3 Replies

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

    David_ 

    It dies not work this way with DAX. you need first to unpivot your table using power quert then you column names will become values in the Attributes column. Then filtering will be simple

    • David_'s avatar
      David_
      New Member

      Found how to do it, thank you for the help.

    • David_'s avatar
      David_
      New Member

      Thank you. 
      I'm not really sure how this works?

      Could you explain a bit?