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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
beachwaves18
New Member

Percent of Customers Returned After 90 Days

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):

beachwaves18_0-1744331295458.png

 

 

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:

Purchase within 90days(%) =

VAR Customerlist = VALUES( Sales[CustomerKey] )

VAR Returndate = 90

VAR CountCustomers = COUNTROWS( FILTER( Customerlist,

CALCULATE( COUNTROWS (Sales),

FILTER( ALLSELECTED ( 'Calendar' ),

'Calendar'[Date] > ( MIN ( Sales[OrderDate] ) ) && 'Calendar'[Date] < MIN ( Sales[OrderDate]) + Returndate ) ) >0 ) )

Return DIVIDE(CountCustomers,[Customers])
 
 
Any help or insight is greatly appreciated.
 
4 REPLIES 4
prasannag
Community Support
Community Support

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

prasannag
Community Support
Community Support

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

johnt75
Super User
Super User

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
Ant_Fri
Frequent Visitor

Hi @beachwaves18 

 

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  :

 

Customer.png

 

and without the customer name which is hopefully close to your requirement :

Customers2.png

Hope this helps

Antonio

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors