March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.