Forum Discussion
LOOKUPVALUE with Direct Query or an alternative needed
- 5 years ago
Glad to help. Can you mark one/more of these as the solution so this thread can be closed.
On a semi-related matter, you don't need LOOKUPVALUE here either. You are thinking VLOOKUP in Excel. In Power BI, you should usually think merge. LOOKUPVALUE has its uses, but it is pretty rare - much rarer than doing any kind of VLOOKUP/XLOOKUP in Excel because of how merges and the data model works.See this file. It shows you how to merge those two tables and bring the TRUE/FALSE column into the first table. In Power BI, it the Transform button on the Home ribbon to get into Power Query to see it.
You can create calculated column in Table 1 using following DAX formula :
My tables did not have enough spacing but i understand what you meant. I have edited.
BULK = LOOKUPVALUE(TABLE2[BULK],TABLE2[CONTROL_NO],TABLE1[CONTROL_NO])
However, I am using direct queries, not imported data, so LOOKUPVALUE does not work and RELATED does not either. I have used the above formula in imported databases and no problem. But for direct query, I need a solution to add a column that pulls in value from another direct query based on a related field.
- kla30115 months agoNew Member
hi i am using direct query too and i need to recreate "user_name =LOOKUPVALUE( users[name], users[id], activities[created_by_id])" in direct query where both the tables users and activities are direct query tables. user_name is then used in a slicer like a dropdown of all those names whos id matches the activities created_by_id .
*using direct query is mandatory, cannot make any changes in pq as its a huge dataset and applying changes crashes the tables.
Thankyou so much in advance.