Hi Community -
I am using the pattern below from the great SQLBI team. However, I think their pattern assumes a date table with direct relationship to Order Date on the sales table. I have a date table, but the primary relationship is to a different date (Due Date).
I do have an indirect relationship established with the Order Date and I can't change my relationships so I need to invoke the USERELATIONSHIP function. I've tried placing that function in several places, and nothing seems to work.
Any guidance is appreciated.
New and returning customers – DAX Patterns
Solved! Go to Solution.
Hi, @texmexdragon2 ;
Try it.
Date New Customer =
CALCULATE (
MIN ( SalesOrdersALL[Order Date] ),
ALLEXCEPT ( SalesOrdersALL, SalesOrdersALL[CustNum] ),
USERELATIONSHIP ( SalesOrdersALL[CustNum], Dim_Customers[CustNum] )
)
Or
Date New Customer =
CALCULATE (
MIN ( SalesOrdersALL[Order Date] ),
FILTER (
ALL ( SalesOrdersALL ),
SalesOrdersALL[CustNum] = MAX ( Dim_Customers[CustNum] )
)
)
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @texmexdragon2 ;
Try it.
Date New Customer =
CALCULATE (
MIN ( SalesOrdersALL[Order Date] ),
ALLEXCEPT ( SalesOrdersALL, SalesOrdersALL[CustNum] ),
USERELATIONSHIP ( SalesOrdersALL[CustNum], Dim_Customers[CustNum] )
)
Or
Date New Customer =
CALCULATE (
MIN ( SalesOrdersALL[Order Date] ),
FILTER (
ALL ( SalesOrdersALL ),
SalesOrdersALL[CustNum] = MAX ( Dim_Customers[CustNum] )
)
)
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
197 | |
80 | |
77 | |
76 | |
46 |
User | Count |
---|---|
168 | |
90 | |
86 | |
80 | |
74 |