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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Need help with Measure

Hello Community  -   The measure below works perfectly for what I am using it for...which is to discern the number of "new" customers.   This measure gives me a scalar value which essentially subtracts returning customers from existing and gives me the number of new customers.  

 

However, what I also need is the actual names of these customers (which is found in this field...[Bill To Customer_CustNum]).   

 

Currently, if I place the measure below in a table, and also place the customer_custnum field in that same table, even if I filter on a particular date (year) the resulting table list the correct number of new customers as the measure total, but it lists ALL of the customers in that period...not just the ones that are new.    So for example, in 2002 we had 442 customers so far in total...and 130 of them were new.    My table ends up showing all 442 customer names...and I only want it to show the names of the 130 that were new.    How do I need to modify this to do that?

 

New Bill to Customers = //calculating which customers within any particular month have purchased but haven't done so for the last X number of days
VAR _CustomersThisMonth = CALCULATETABLE(VALUES(SalesOrdersALL[Bill To Customer_CustNum]),USERELATIONSHIP('Dim_Date Table'[Date],SalesOrdersALL[Order Date]))
VAR _PriorCustomers = CALCULATETABLE(VALUES(SalesOrdersALL[Bill To Customer_CustNum]),USERELATIONSHIP('Dim_Date Table'[Date],SalesOrdersALL[Order Date]),ALL(SalesOrdersALL[Order Date Year]),ALL(SalesOrdersALL[Order Date Month]),ALL(SalesOrdersALL[Order Date Day]),
FILTER(ALL(SalesOrdersALL[Order Date]),
SalesOrdersALL[Order Date] > MIN(SalesOrdersALL[Order Date]) - [Churn Time Frame Value]
&& SalesOrdersALL[Order Date] < MIN(SalesOrdersALL[Order Date])))
VAR _NewCustomers = COUNTROWS(EXCEPT(_CustomersThisMonth,_PriorCustomers))

RETURN
_NewCustomers
1 REPLY 1
v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous ,

 

Maybe you can try use Dim_Date table to do the filter, let the range of dim_date between time period you want.

 

New Bill to customers =
VAR _CustomersThisMonth =
    CALCULATETABLE (
        VALUES ( SalesOrdersALL[Bill To Customer_CustNum] ),
        USERELATIONSHIP ( 'Dim_Date Table'[Date], SalesOrdersALL[Order Date] )
    )
VAR _PriorCustomers =
    CALCULATETABLE (
        VALUES ( SalesOrdersALL[Bill To Customer_CustNum] ),
        USERELATIONSHIP ( 'Dim_Date Table'[Date], SalesOrdersALL[Order Date] ),
        
        // 
        FILTER (
            ALL ( 'Dim_Date Table'[Date] ),
            [Date] // Time period you want
                > MIN ( SalesOrdersALL[Order Date] ) - [Churn Time Frame Value]
                && [Date] < MIN ( SalesOrdersALL[Order Date] )
        )
    ) //
    
VAR _NewCustomers =
    COUNTROWS ( EXCEPT ( _CustomersThisMonth, _PriorCustomers ) )
RETURN
    _NewCustomers

 

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors