Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
Check it out now!Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hello, I'm trying to create a DAX formula to find the % of customers that returned 90 days after their first purchase. I've spent several hours trying to create and recreate the formula but have not been able to replicate the numbers in the screenshot (for the 3rd or 4th column):
I know there are other posts online about this, but none of the formulas have worked for me or any manipulations. I have a Sales table with CustomerKey and OrderDate. I have a Customer table with CustomerKey and DateFirstPurchase. I've spent many hours working on this and various formulas but this is the one I'm working with now:
Hi @beachwaves18,
We wanted to kindly check in to see if everything is working as expected after trying the suggested solution. If there’s anything else we can assist with, please don’t hesitate to ask.
If the issue is resolved, we’d appreciate it if you could mark the helpful reply as Accepted Solution — it helps others who might face a similar issue.
Warm regards,
Prasanna Kumar
Hi @beachwaves18,
Thank you for reaching out to the Microsoft Fabric Forum Community.
Also, thanks to @johnt75 and @Ant_Fri for the prompt and helpful response.
Just following up to check if the solution shared by our Super User helped resolve your issue. If you're still facing difficulties or need further assistance, please let us know — we’re here to help!
If the response addressed your query, we kindly request you to mark it as Accepted Solution and click Yes if you found it helpful. This supports others in the community as well.
If you find this response helpful, please consider marking it as the accepted solution and giving it a thumbs-up to support others in the community.
Thank you & Regards,
Prasanna kumar
Try
Purchase within 90days(%) =
VAR AllCustomers = [Customers]
VAR ReturnWithin90Days =
SUMX (
Customerlist,
VAR FirstPurchase = Customerlist[DateFirstPurchase]
VAR NumPurchases =
CALCULATE (
COUNTROWS ( Sales ),
DATESINPERIOD ( 'Calendar'[Date], FirstPurchase + 1, 89, DAY )
)
VAR Result =
IF ( NumPurchases > 1, 1 )
RETURN
Result
)
VAR Result =
DIVIDE ( ReturnWithin90Days, AllCustomers )
RETURN
Result
I suggest use these 4 measures :
1.
TotalCustomers = COUNTROWS(Customer)
2.
TotalCustomersByDateFirstPurchase =
CALCULATE(COUNTROWS(Customer), ALLEXCEPT(Customer, Customer[DateFirstPurchase - Customer Table]))
3.
CustomersReturnedWithin90Days =
VAR CustomersWithReturn =
CALCULATETABLE(
VALUES(Sales[Customer Key - Sales Table]),
FILTER(
Sales,
Sales[OrderDate - Sales Table] <= RELATED(Customer[DateFirstPurchase - Customer Table]) + 90
)
)
RETURN
COUNTROWS(CustomersWithReturn)
4.
PercentageReturnedAfter90Days =
DIVIDE([CustomersReturnedWithin90Days], [TotalCustomersByDateFirstPurchase])
to get the below :
and without the customer name which is hopefully close to your requirement :
Hope this helps
Antonio