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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
akzimmerman
Regular Visitor

Percent Customers Who Returned 90 days after First Purchase

I am trying to create DAX expressions to determine the percentage of customers that returned 90 days after their first purchase and also determine the percentage of customers that returned 3 months after the first 90 days.

 

There is a Customers Table which has the following columns: CustomerKey, DateFirstPurchase and there is a Sales Table which has the following columns: CustomerKey, OrderDate.

 

Below is the end result expected from the full data to be a reference for the ask and the file of the data is uploaded as well.  I have been able to determine the first 2 columns of the expected results, but need help on the percentages in the 3rd and 4th columns.

  

Link to PowerBI

PowerBI Data 

 

I have tried the following DAX measure to get the percent of customers who returned after 90 days, but I am not receiving the correct results. I am unsure what I am missing. 

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]) ​

 


Thanks!

 

 

 

Capture.PNG

2 REPLIES 2
beachwaves18
New Member

Were you able to figure this out? I'm stuck on it too and have tried several changes to my formula

shafiz_p
Super User
Super User

Hi @akzimmerman  Try the below measures:

Total Customers = COUNTROWS(Customers)

 

Customers Returning 90 Days = 
COUNTROWS(
    FILTER(
        Customers,
        VAR FirstPurchase = Customers[DateFirstPurchase]
        VAR EndDate90 = FirstPurchase + 90
        RETURN
            CALCULATE(
                COUNTROWS(Sales),
                Sales[OrderDate] > FirstPurchase,
                Sales[OrderDate] <= EndDate90
            ) > 0
    )
)

 

% Returning Within 90 Days = 
DIVIDE(
    [Customers Returning 90 Days],
    [Total Customers]
)

 

Customers Returning 90-180 Days = 
COUNTROWS(
    FILTER(
        Customers,
        VAR FirstPurchase = Customers[DateFirstPurchase]
        VAR StartDate90 = FirstPurchase + 90
        VAR EndDate180 = FirstPurchase + 180
        RETURN
            CALCULATE(
                COUNTROWS(Sales),
                Sales[OrderDate] > StartDate90,
                Sales[OrderDate] <= EndDate180
            ) > 0
    )
)

 

% Returning 90-180 Days = 
DIVIDE(
    [Customers Returning 90-180 Days],
    [Total Customers]
)

 

Hope this helps!!

If this solved your problem, please accept it as a solution!!

 

Best Regards,
Shahariar Hafiz

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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