Formula Generator | DAX

DAX Integration of Customer and Sales Tables

This guide outlines a DAX formula using the RELATED function to combine Customer and Sales tables, enabling consolidated sales performance analysis linked to customer data. It includes example tables and practical usage for better


Empty image or helper icon

Prompt

combines customer table with sales table

Answer

DAX Formula for Combining Customer and Sales Tables

Objective

To create a DAX formula that combines information from a Customer table and a Sales table, allowing for consolidated analysis of sales performance linked to customers.

Assumptions

  • The Customer table contains customer details with a unique identifier named CustomerID.
  • The Sales table contains sales transaction details, including a CustomerID column to correlate with the Customer table and additional sales information.

DAX Formula

To combine the two tables using DAX, you can use the RELATED function in a calculated column of the Sales table to bring in data from the Customer table. Here is an example formula that extracts the CustomerName from the Customer table and includes it in the Sales table:

CustomerName = RELATED(Customer[CustomerName])

Explanation

  • RELATED Function: This function fetches the related value from another table based on an existing relationship. In this case, it retrieves the CustomerName from the Customer table where CustomerID matches that in the Sales table.
  • Calculated Column: The above formula should be placed in the Sales table as a new calculated column. Once created, it will automatically populate with the corresponding customer names based on the defined relationship.

Practical Illustration

Assuming we have the following sample data:

Customer Table:

CustomerID CustomerName
1 John Doe
2 Jane Smith
3 Sam Johnson

Sales Table:

SaleID CustomerID Amount
101 1 150
102 2 200
103 1 300
104 3 250

After applying the DAX formula, the Sales table will output:

SaleID CustomerID Amount CustomerName
101 1 150 John Doe
102 2 200 Jane Smith
103 1 300 John Doe
104 3 250 Sam Johnson

Summary

  • The DAX formula provided allows for seamless integration of customer names into sales records, facilitating management and analysis of sales data linked to specific customers.
  • It demonstrates how to leverage relationships within a data model effectively.

Additional Learning

Consider exploring courses on the Enterprise DNA Platform for a deeper understanding of DAX functions and data modeling practices.

Create your Thread using our flexible tools, share it with friends and colleagues.

Your current query will become the main foundation for the thread, which you can expand with other tools presented on our platform. We will help you choose tools so that your thread is structured and logically built.

Description

This guide outlines a DAX formula using the RELATED function to combine Customer and Sales tables, enabling consolidated sales performance analysis linked to customer data. It includes example tables and practical usage for better understanding.