Forum Discussion

rmcgrath's avatar
rmcgrath
Advocate II
1 year ago
Solved

Help with a lookup?

I am trying to make a custom column that would use these three values and if it matches any of the three in a column from a different table, it will return a value from that table.  Here are the thre...
  • techies's avatar
    1 year ago

    Hi rmcgrath are you looking for lookupvalue function in dax ?

     

    Column =
    VAR Match1 = LOOKUPVALUE('Site Table'[Site], 'Site Table'[Site Lookup], 'First Table'[Dept Loc Code])
    VAR Match2 = LOOKUPVALUE('Site Table'[Site], 'Site Table'[Site Lookup], 'First Table'[Department Code])
    VAR Match3 = LOOKUPVALUE('Site Table'[Site], 'Site Table'[Site Lookup], 'First Table'[Location Code])

    RETURN
    COALESCE(Match1, Match2, Match3, "No Match")

  • lbendlin's avatar
    lbendlin
    1 year ago

    Please try to avoid LOOKUPVALUE. If there is a data model, use the data model. If there isn't, use TREATAS.  LOOKUPVALUE should be the very last resort.