Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Arul

How to Find Missing Customers in Power BI Using DAX Functions?

Sample Data:

 

Table 1: Customer1

 

| CustomerID | CustomerName |
|------------|----------------|
| 1 | Acme Corp |
| 2 | Globex Inc. |
| 3 | Soylent Corp |
| 4 | Initech |
| 5 | Umbrella Corp |

 

Table 2: Customer2

 

| CustomerID | CustomerName |
|------------|----------------|
| 2 | Globex Inc. |
| 3 | Soylent Corp |
| 5 | Umbrella Corp |

 

As we can see, `Customer1` has two customers that are not present in `Customer2`: Acme Corp and Initech.

 

Approach 1: Using EXCEPT and CONCATENATEX Functions

 

The first approach uses the `EXCEPT` function to find the missing customers and the `CONCATENATEX` function to display them in a Power BI card.

 

Finding Missing Customers

 

 

 

Missing Customers = 
EXCEPT(
    ALL(Customer1[CustomerName]),
    ALL(Customer2[CustomerName])
)

 

 

 

Displaying the Output

 

 

 

Missing Customers List = 
CONCATENATEX(
    'Missing Customers',
    [CustomerName],
    ", "
)

 

 

 

 

Approach 2: Using Calculated Columns

The second approach involves creating a calculated column in `Customer1` to indicate whether each customer is missing in `Customer2`.

 

Creating a Calculated Column

 

 

 

Is Missing = 
IF(
    ISBLANK(LOOKUPVALUE(Customer2[CustomerName], Customer2[CustomerName], Customer1[CustomerName])),
    "Missing",
    "Not Missing"
)

 

 

 

Displaying Missing Customer Names

To display the names of the missing customers in a card visual, you can create a visual with the "CustomerName" field from "Customer1" and apply a filter to only show the customers marked as "Missing."

 

Approach 3: Using DAX Measures

 

To display the names of the missing customers in a card visual using this measure, you can create a new measure that uses `CONCATENATEX` to list the missing customer names:

 

 

 

Missing Customer Names = 
CONCATENATEX(
    FILTER(Customer1, NOT(Customer1[CustomerName] IN VALUES(Customer2[CustomerName]))),
    Customer1[CustomerName],
    ", "
)

 

 

 

This measure will create a comma-separated list of the missing customer names, which can be displayed in a Power BI card.

 

Conclusion

By using DAX functions in Power BI, we have three efficient methods to identify and display missing customers:

1. Using `EXCEPT` and `CONCATENATEX` to find and list missing customers.
2. Creating a calculated column to mark customers as missing and filtering a visual to display their names.
3. Creating a DAX measure to list the names of missing customers.

 

Each method has its own advantages and can be chosen based on the specific requirements of your report. Remember to replace the table and column names in the sample DAX formulas with the actual names used in your Power BI model.

Comments