Data Table vs Lookup Table in Power BI

Data Table vs Lookup Table in Power BI

Power BI is a powerful tool for data analysis that helps organisations to visualise and analyse their data. Understanding the difference between data tables and lookup tables is important for building efficient data models. These two types of tables serve different purposes and form an important part of data relationships. Both tables work together to enable accurate filtering and aggregation in your reports with the help of well-defined relationships. In this blog, you will learn about data tables and lookup tables with definitions, structure, and key differences between them.

Table of Contents:

What are Data Tables in Power BI?

A data table in Power BI, also known as a fact table, is a kind of table where your main or core events are stored. It contains detailed records that represent actions and operations of organizations or users.

Structure of a Data Table

The data table contains-

  • A unique identifier, like SalesID
  • Foreign keys for relating two tables together, like CustomerID.
  • Numerical measures like SaleAmount.
  • Date of tracking.

Example: A Sales table of a Company that shows sales of a product.

SaleID ProductID CustomerID Quantity SaleAmount SaleDate
1001 P01 C03 3 15.00 2024-09-15
1002 P02 C02 2 8.00 2024-09-16
1003 P01 C01 1 5.00 2024-09-16

Benefits of Data Tables in Power BI

  • They help in holding all the major facts and information needed to create KPIs and dashboards.
  • Data tables help users to analyse trends and track performance over time.
  • Data tables are granular, letting you zoom in from high-level summaries to individual records.
  • Data tables are used to link multiple lookup tables.
  • A data table allows a user to load a million records, and the user will get fast performance if modelled correctly.
Become a Power BI expert – Create stunning visuals and smart insights!
Enroll now and get job-ready faster.
quiz-icon

What is a lookup Table in Power BI?

A lookup table, also called a dimensional table, is used to store descriptive information about entities involved in your data. Lookup tables are used to enrich your data by providing labels, categories, and attributes.

Structure of the lookup table

The lookup table contains-

  • Product Table: This is used to contain information about a product, like the Product Name.
  • Customer Table: This is used to contain information about customers like CustomerName, Region.
  • Calendar Table: This table provides a rich set of attributes about dates.

Example: A Product table that contains product information.

ProductID ProductName Category
P001 Coffee Beans Beverages
P002 Green Tea Beverages
P003 Notebook Stationery

Benefits of Lookup Tables in Power BI

  • Lookup tables help to improve readability by replacing codes with meaningful names.
  • One lookup table can be used across multiple data tables.
  • They make navigation of models easier by separating metadata from data.
  • Lookup tables promote flexibility, allowing users to change descriptions or categories without modifying core data.
  • Lookup tables promote better filtering with the help of slicers and filters.

Functionality of Lookup Tables in Power BI

  • Filtering: The Lookup table uses a slicer to filter your visual.
  • Grouping: Lookup tables group and categories data using attributes like region, segments, or product.
  • Relationship: Create a one-to-many relationship from lookup tables to fact tables.
  • Sorting: Apply custom sort orders using lookup fields.

Differences Between Data Tables and Lookup Tables in Power BI

Feature Data Table Lookup Table
Purpose The Data tables are used to store transactional data. Lookup tables are used to store descriptive data.
Row Granularity The Data Table has one row per transaction. Lookup table promotes one row per entity.
Measures The data table contains measures. Lookup tables do not contain measures.
Slicers Slicers in data tables are rarely used. Slicers in lookup tables are mostly used.
Data Volume The Data Table contains large data. A lookup table contains small to moderate data.
Used in Calculations Data tables are used in calculations. Lookup tables are used in grouping.
Performance Data tables have high performance if the data model is optimised well. Lookup tables have comparatively low performance.
Example Sales, Order, Events table. Products, Customers, Dates table

How to Create a Data Table and a Lookup Table in Power BI

Consider a Sales( Data Table) and Products( Lookup Table).

1. Sales Table

SaleID Date ProductID CustomerID Quantity Revenue
1 2023-01-01 P001 C001 2 100
2 2023-01-03 P002 C002 1 50
3 2023-01-05 P003 C003 3 90

2. Product Table

ProductID ProductName Category
P001 Coffee Beans Beverages
P002 Green Tea Beverages
P003 Notebook Stationery

Step 1: To work with these datasets, you need to load them into Power BI.

Click on Home > Get Data > Text/CSV

Sales Table:

sales table

The Sales table looks like this once we loaded it into Power BI.

Product Table:

product table

This is what the Product Tables look like after loading them in Power BI.

Step 2: Check the relationship

Go to Model View and drag ProductID from Sales onto ProductID in Products.

Make sure the relationship is Many to One from the Sales table (many side) to the Product table (one side) and Single Direction.

check the relationship

As you can see, there is a relationship built between the two tables and connected by a line.

Step 3: Use Visual

  • From the visualisation pane, create a slicer with ProductName from Products
  • Create a table visual with revenue from Sales
step3 use visual

This is Slicer created from a lookup table, which is used to filter the Table(Data Table).

Get 100% Hike!

Master Most in Demand Skills Now!

Real-World Examples

1. Data Table: E-commerce Transaction

An online e-commerce store wants to record every order in a data table

  • Field: OrderID, Date, ProductID, UserID, TotalAmount.
  • This Table is also called a fact table, which is used to store transactional data.
  • It helps the company to examine the daily sales graph and trends, and helps in identifying high performance.
  • Each row is used to represent a unique transaction.
  • This is used to track how much revenue was made.

2. Lookup Table Example: Product Master

The product master table contains:

  • Fields: ProductID, ProductName, Category, Brand
  • This helps the business categorise sales, track trends by brand or category, and make better inventory decisions.
  • This table acts as a dimension table, which helps in categorising the data.
  • It allows filtering and slicing of sales data with the help of category attributes .
  • This table helps businesses to track sales performance by product and other categories.

By combining these two tables, they will provide clear insights and detailed information.

Best Practices

  • Try to implement a star schema by connecting one fact table with multiple lookup tables, as it improves performance and clarity.
  • Avoid bi-directional relationships and use single-directional relationships to prevent performance issues.
  • Use keys to join tables, which is a consistent and much better way to relate one table to another.
  • Clean your lookup table by removing duplicate and blank values.
  • Maintain documentation or use naming conventions to clarify what each table and relationship represents.

Conclusion

Data tables and lookup tables may appear similar, but they serve very different purposes in Power BI. Data tables are your core tables, which contain core and informative data, while lookup tables are the labels that make sense of the core data stored in the data table. When they work together, they form support for the data model. By understanding their differences and functions, you can build reports that run faster and help in extracting information.

To learn more about Power BI and its functions, check out this Power BI Course and also explore Power BI Interview Questions prepared by industry experts.

Data Table vs Lookup Table in Power BI- FAQs

Q1. What’s the main difference between a data table and a lookup table?

The main difference between a data table and a lookup table is that a data table stores facts, while a lookup table stores labels for that fact data.

Q2. Can a lookup table be used in multiple relationships?

Yes, a lookup table can work in multiple tables, as this allows consistent filtering across different datasets.

Q3. Should I always use a star schema in Power BI?

Yes, it is a best practice to use a star schema as it connects one fact or Data table with multiple lookup tables.

Q4. What happens if there's no relationship between my tables?

If no relationship exists between the table and slicer, then the visuals you made won’t work properly.

Q5. What’s better: One big table or separate data/lookup tables?

Separate tables are better as they make your model more efficient, flexible, and easier to maintain.

About the Author

Data Analyst & Machine Learning Associate

As a Data Analyst and machine learning associate, Nishtha combines her analytical skills and machine learning knowledge to interpret complicated datasets. She is also a passionate storyteller who transforms crucial findings into gripping tales that further influence data-driven decision-making in the business frontier.

Data Analytics for Business