Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
This seems like it should be such a simple operation.
I have a requirement where I need to count the distinct Customer IDs of Customers that are new. Said another way, count the distinct customer ID where the order date matches the minimum order date of that customer (and several other dimensions).
I have found this to be nearly impossible.
I am able to get the correct count, and put it into a card. I'm even able to cross filter that card by other dimensions. But I need to take it a step further and show which months the New Customers appeared in.
I am aware that using a CALCULATEDTABLE, getting the minimum date by customer & my required dimensions, would solve my problem. Unfortunately, I am working in a Semantic Model, which I am unable to update.
That doesn't change that this seems like such a simple requirement, and I sincerely hope that something so seemingly simple can be done with measures.
Below is my code.
[__NewAccounts_A_FirstOrderDate] =
var maxContextDate = CALCULATE( MAX( Dates[Date] ), ALLSELECTED( 'Sales' ) )
var filteredSales =
ADDCOLUMNS(
SUMMARIZE(
FILTER(
CALCULATETABLE(
Sales,
REMOVEFILTERS( Dates[Date] )
, REMOVEFILTERS( 'Product Details' )
, REMOVEFILTERS( 'Product Packaging' )
),
[C/E] > 0 &&
Sales[DeliveryDate] >= DATE( YEAR( maxContextDate ) - 1, 1, 1 )
),
Supplier[Supplier], // Group by SUPPLIER
Customer[Customer No.], // Group by Customer
Branch[Branch], // Group by Branch
"Min Customer Date", MIN( Dates[Date] ) // Calculate Minimum Delivery Date by Group
)
, "GB Brand", SELECTEDVALUE( 'Product Details'[GB Brand] )
, "Package Type", SELECTEDVALUE( 'Product Packaging'[Package Type] )
)
var Result =
CALCULATE(
MINX(
FILTER(
filteredSales,
[Min Customer Date] >= DATE( YEAR( maxContextDate ), 1, 1) && // Ensure the date is in the same year as max context date
[Min Customer Date] <= maxContextDate
),
[Min Customer Date] // Return the minimum date
)
, REMOVEFILTERS( Dates[Date] )
)
RETURN Result[__NewAccounts_B_FirstOrderInContext]
var maxContextDate = CALCULATE( MAX( Dates[Date] ), ALLSELECTED( 'Sales' ) )
return
IF(
[__NewAccounts_A_FirstOrderDate] >= DATE( YEAR( maxContextDate ), 1, 1)
&& [__NewAccounts_A_FirstOrderDate] <= maxContextDate,
1, // Eligible New Account
0 // Ineligible New Account
)__NewAccounts_C_DistinctNewCustomerCount
VAR newAccounts =
CALCULATE (
COUNTX (
// Only count customers with a new account in the current year
FILTER ( VALUES ( Customer[Customer No.] ), [__NewAccounts_B_FirstOrderInContext] = 1 ),
// Count unique Customer Numbers
Customer[Customer No.]
),
// Remove external filters on Sales but retain the current user context
ALLSELECTED( Sales )
)
// Step 2: Calculate the number of new accounts that also have cross-filtering applied
VAR newAccounts_CF =
CALCULATE (
COUNTX (
FILTER (
VALUES ( Customer[Customer No.] ),
[__NewAccounts_B_FirstOrderInContext] = 1 // Only count customers with a new account in the current year
&& [___NewAccounts_CrossFilter] > 0 // Check Cross Filtering from Brand Sales
),
Customer[Customer No.]
)-- , ALLSELECTED( Sales )
)
// Step 3: Check if there is a cross-filter on 'Product Details' or 'Product Packaging'.
// If so, return the new accounts count with the cross-filter applied (newAccounts_CF),
// otherwise return the count without cross-filtering (newAccounts).
VAR result =
IF(
ISCROSSFILTERED( 'Product Details' ) || ISCROSSFILTERED( 'Product Packaging' ) ,
// Add 0 to force conversion to a numeric result
newAccounts_CF + 0,
newAccounts + 0
)
return resultYet, when I attempt to plot this data on a Line chart, it shows the Total count for each month. I don't get it.
This to me should work.
Can anyone smarter than me provide any assistance here?
https://www.daxpatterns.com/new-and-returning-customers/
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 32 | |
| 31 | |
| 18 | |
| 12 | |
| 11 |