Forum Discussion

agustin_garcia's avatar
agustin_garcia
Frequent Visitor
10 years ago
Solved

Using LOOKUPVALUE with dinamically created column names

Hello, I need to use LOOKUPVALUE to gather data from a second table, where result_ from_column column's name is based on data existing in current table. Hence I need to pass a column name that is di...
  • agustin_garcia's avatar
    agustin_garcia
    10 years ago

    Hi again,

    Just to confirm that I was able to understand your porposal (and your comment regargin unpivoting the table)

    I did created a temp unpivoted table via Power Query then the solution was easy to implement, which I achieved doing something like:

     

    Shift = LOOKUPVALUE (
            unpivot_from_table[Shift],
            unpivot_from_table[Resource Name], current_table[Time Entry Resource Name],
            unpivot_from_table[Week], WEEKNUM(current_table[week_start_date])
      )

     

    The solution basically makes use of a  LEFT JOIN in SQL implemented in DAX via the LOOKUPVALUE function as depicted in SQL BI's From SQL to DAX: Joining Tables article. 

     

    The unpivoted table (by creating a new tab in my Excel file and applying power query's Unpivot function, looks like:

    unpivot_from_table

    employee_nameWeekShift
    emp1101st
    emp1112nd
    emp2101st
    emp2111st