How to VLOOKUP in Power BI from Another Table
If you're making the jump from Excel to Power BI, one of the first things you'll probably look for is VLOOKUP. It’s the trusty tool for pulling data from one table into another, and it’s a cornerstone of many Excel workflows. However, you’ll soon find Power BI doesn't have a VLOOKUP function in the way you're used to. This isn't a limitation, it's by design. Power BI uses a more powerful and scalable relational data model. This tutorial will guide you through the various ways to accomplish the same goal as VLOOKUP in Power BI, helping you connect your tables and build richer reports.
Why Power BI Does VLOOKUP a Little Differently
Excel operates on a cell-based grid. A VLOOKUP goes on a hunt for a specific value in a column and returns a corresponding value from a cell in that same row. It’s a direct, one-time fetch.
Power BI, on the other hand, thinks in terms of entire tables and the relationships between them. Instead of looking up individual cells, it's designed to understand how your 'Sales' table connects to your 'Products' table, or how your 'Customers' table relates to your 'Orders' table. This approach allows you to filter and slice data across multiple tables simultaneously in a fast, efficient way that would bring even a robust Excel file to its knees. Once you get the hang of it, you'll see it’s a far more robust system for analysis.
Let's look at three primary methods to get that VLOOKUP result: using a data model relationship (the best way), the 'LOOKUPVALUE' function (a great alternative), and merging tables in Power Query (a different approach altogether).
The Scenario: Bringing Product Details into Sales Data
To make this practical, let's use a common business scenario. Imagine you have two tables:
- SalesData: A table listing every transaction. It has columns like 'OrderID', 'ProductID', 'OrderDate', and 'UnitsSold'.
- ProductLookup: A reference table with details for each product. It includes columns like 'ProductID', 'ProductName', 'Category', and 'Price'.
Our goal is to pull the 'ProductName' and 'Price' from the 'ProductLookup' table into the 'SalesData' table so we can analyze sales by product name and calculate the total revenue for each transaction.
Method 1: Creating Relationships and Using the RELATED Function (The Best Practice)
This is the standard, most efficient, and recommended way to work in Power BI. By creating a relationship, you’re not physically copying data from one table to another. Instead, you're just telling Power BI how the tables are connected. This keeps your data model lean and highly performant.
Step 1: Load Your Data
First, get your two tables ('SalesData' and 'ProductLookup') into Power BI Desktop. You can do this by using the "Get Data" option on the Home ribbon and connecting to your source, whether it's an Excel workbook, a database, or another source.
Step 2: Go to the Model View
On the left-hand side of the Power BI window, you'll see three icons: Report, Data, and Model. Click on the Model view icon (it looks like a small diagram with connected boxes). This is where you manage relationships between your tables.
Here, you'll see boxes representing each of your tables. Power BI often automatically detects relationships based on column names. If you see a line already connecting 'ProductID' in both tables, Power BI has already done the work for you!
Step 3: Create the Relationship
If there's no line connecting the tables, you'll need to create the relationship manually. It’s as simple as clicking and dragging.
- Find the common column that connects both tables. In our case, it's 'ProductID'.
- Click on the 'ProductID' column in the 'SalesData' table.
- Drag your mouse over to the 'ProductID' column in the 'ProductLookup' table and release the click.
A line will now connect the two tables, indicating a relationship has been formed. If you hover over the line, it will highlight the keys ('ProductID' in both tables). This defines a 'one-to-many' relationship: one product in the 'ProductLookup' table can have many sales transactions in the 'SalesData' table.
Step 4: Use the RELATED Function for Your 'VLOOKUP'
Now that Power BI understands how the tables are linked, you can easily pull in data using the DAX function 'RELATED'. 'RELATED' works by following the established relationship to fetch a value from the "one" side of the relationship.
- Navigate to the Data view by clicking the icon on the left (it looks like a spreadsheet grid).
- Select your 'SalesData' table from the Fields pane on the right.
- In the ribbon at the top, click on "New Column". This will open the formula bar.
- To get the product name, enter the following DAX formula and press Enter:
ProductName = RELATED(ProductLookup[ProductName])
Instantly, a new column called 'ProductName' appears in your 'SalesData' table, populated with the correct values from the 'ProductLookup' table. 'RELATED' followed the relationship using the 'ProductID' on each row to find the matching product name.
Let's do it again to get the price. Create another new column with this formula:
Price = RELATED(ProductLookup[Price])
And to complete our exercise, we can now calculate the total revenue. Create one more new column:
TotalRevenue = SalesData[UnitsSold] * SalesData[Price]
You have now successfully mimicked VLOOKUP, and you can build visuals in the Report view using these new calculated columns.
Method 2: Using the LOOKUPVALUE Function
Sometimes, creating a formal relationship isn't practical. You might be working with a complex data model with multiple possible relationships, or you may just need a one-off lookup without modifying the model. For these cases, 'LOOKUPVALUE' is your go-to function. It works much more like the Excel VLOOKUP you know and love.
'LOOKUPVALUE' searches for a value in a specified column and returns a value from the same row in another column.
The Syntax
The basic syntax is:
LOOKUPVALUE( <result_column>, <search_column>, <search_value> )
How to Use It
Let's assume there is no active relationship between our 'SalesData' and 'ProductLookup' tables for this example.
- In the Data view, select the 'SalesData' table and click "New Column".
- Type the following formula into the formula bar:
ProductName LOOKUP = LOOKUPVALUE( ProductLookup[ProductName], -- 1. The value you want to RETURN ProductLookup[ProductID], -- 2. The column you want to SEARCH IN SalesData[ProductID] -- 3. The value you're SEARCHING FOR )
This formula tells Power BI: "For the current row in the 'SalesData' table, take the 'ProductID', go over to the 'ProductLookup' table, find the matching 'ProductID' there, and return the corresponding 'ProductName'."
While 'LOOKUPVALUE' is very useful, it can be less performant than 'RELATED' on extremely large datasets because it has to perform a fresh search for every single row. 'RELATED' leverages the pre-built, optimized index of the relationship. As a rule of thumb, always try to use relationships and 'RELATED' first.
Method 3: Merging Tables in Power Query
This third method takes a completely different approach. Instead of creating a calculated column in your data model using DAX, you physically combine the two tables before they are loaded into the model. This is called "shaping" the data, and you do it in the Power Query Editor.
This approach is excellent if you know you'll always want the data combined and prefer working with one wider, flatter table rather than two separate ones.
Step 1: Open the Power Query Editor
From the Home ribbon in Power BI Desktop, click "Transform Data". This will launch the Power Query Editor, which is a powerful tool for cleaning, transposing, and preparing your raw data before analysis.
Step 2: Select "Merge Queries"
In the list of Queries on the left, select your "main" table - in our case, 'SalesData'. From the Home ribbon inside the Power Query Editor, click the "Merge Queries" button.
Step 3: Configure the Merge
A new window will appear. Here's how to fill it out:
- The top dropdown should already show 'SalesData'. Click on the 'ProductID' column to select it as the join key.
- In the second dropdown, select the 'ProductLookup' table.
- Click on the 'ProductID' column in the bottom preview to select it as the matching key.
- For the "Join Kind", leave it as Left Outer. This is the direct equivalent of VLOOKUP. It keeps all rows from the first table and brings in matches from the second.
- Click OK.
Step 4: Expand the New Column
You’ll be back in the Power Query Editor, and you'll see a new column has been added to the far right, typically named after the table you merged (e.g., 'ProductLookup'). Each cell just says "Table". To pull out the specific data you want, click the expand icon (two opposing arrows) in the column header.
- A dropdown will appear with all the columns from the 'ProductLookup' table.
- Uncheck "(Select All Columns)".
- Check the boxes for 'ProductName' and 'Price' - the columns you want to add.
- Uncheck the box that says "Use original column name as prefix." This prevents your new columns from being named 'ProductLookup.ProductName'.
- Click OK.
And just like that, 'ProductName' and 'Price' are now columns in your 'SalesData' table.
Step 5: Close & Apply
Finally, click "Close & Apply" in the top-left corner of the Power Query Editor to load your newly shaped, merged table into your Power BI model.
Final Thoughts
Transitioning from Excel's cell-by-cell VLOOKUP to Power BI's relational model is a key paradigm shift, but it unlocks far more powerful and scalable analytics. Using relationships and 'RELATED' is the gold standard for connecting data, while 'LOOKUPVALUE' offers a flexible alternative for special cases. Merging in Power Query is perfect for when you want to permanently combine your data tables before your analysis even begins.
Getting your data model right is the foundation of any great report, but we know that learning DAX and navigating Power Query can take time. For teams who need to get insights quickly without a long learning curve, we built Graphed. After connecting your data sources, you can type straightforward questions like "What were my total sales by product category last quarter?" and get a live, interactive dashboard in seconds. We handle all the data connections, transformations, and calculations in the background, so you can focus on making decisions, not on writing formulas.
Related Articles
How to Enable Data Analysis in Excel
Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.