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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Measure using CALCULATE, FILTER and USERELATIONSHIP

Hello Community  -  The measure below works but with one important problem:   it is referencing the wrong date.  

 

In my salesorders table, we normally use "due date" and that is our primary connection to the date table.   I have an inactive relationship to the date table with "order date"  and that is the date I need to incorporate below.   I've tried placing USERELATIONSHIP into the measure but with no luck.    

 

We of course want to base our new customers on the date they placed an order, not the due date of the order.   And that is what this measure needs to do.  

 

New Customers = //calculating which customers within any particular month have purchased but haven't done so for the last X number of days
VAR _CustomersThisMonth = VALUES(SalesOrdersALL[CustNum_Cust_Seq_Orders])
VAR _PriorCustomers = CALCULATETABLE(VALUES(SalesOrdersALL[CustNum_Cust_Seq_Orders]),
FILTER(ALL('Dim_Date Table'),
'Dim_Date Table'[Date] > MIN('Dim_Date Table'[Date]) - [Churn Time Frame Value] &&
'Dim_Date Table'[Date] < MIN('Dim_Date Table'[Date])))

RETURN
COUNTROWS(EXCEPT(_CustomersThisMonth,_PriorCustomers))
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

You need to use CALCULATETABLE and USERELATIONSHIP for both your _CustomersThisMonth and _PriorCustomers variables.

View solution in original post

3 REPLIES 3
julie_13579
Regular Visitor

Formula works perfectly! Do you also have a formula for lost clients? 

RETURN
COUNTROWS(EXCEPT(_PriorCustomers,_CustomersThisMonth))
lbendlin
Super User
Super User

You need to use CALCULATETABLE and USERELATIONSHIP for both your _CustomersThisMonth and _PriorCustomers variables.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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