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

Retention metrics 3 Month rolling

Hi, 

 

I am trying to create a measure that returns the number of new customers in selected date that came back for the second time within 3 months a retention metric.

 

I have three tables : calendar, Customers, Orders. 

I don't really know where to start with the measure, that's why i need your help.

 

I already tried this measure : ( copied from another question) by changing the number of months)

 

Retention Rate =
var __lastVisibleDate = LASTDATE( 'Calendar'[Date] )
var __shouldCalculate =
    // __lastVisibleDate.
    NOT(
        ISBLANK( NEXTDAY( DATEADD(__lastVisibleDate, -3, month ) ) )
        &&
        ISBLANK( DATEADD( NEXTDAY( __lastVisibleDate ), -3, month ) )
    )
var __result =
    if( __shouldCalculate,
    
        var __custWithPurchWithinLast3Months =
            CALCULATETABLE(
                VALUES( Orders[External ID] ),
                DATESINPERIOD(
                    'Calendar'[Date],
                    __lastVisibleDate,
                    -3,
                    MONTH
                )
            )
        var __lastVisibleDateMinus3Months =
            dateadd( __lastVisibleDate, -2, month )
        var __custWithPurch1MonthBeforeLast3Months =
            CALCULATETABLE(
                VALUES( Orders[External ID] ),
                DATESINPERIOD(
                    'Calendar'[Date],
                    __lastVisibleDateMinus3Months,
                    -1,
                    MONTH
                )
            )
        var __custThatBoughtInBothPeriods =
            INTERSECT(
                __custWithPurchWithinLast3Months,
                __custWithPurch1MonthBeforeLast3Months
            )
        var __ratio =
            DIVIDE(
                countrows( __custThatBoughtInBothPeriods ),
                COUNTROWS( __custWithPurchWithinLast3Months )
            )           
        return
            __ratio
    )
RETURN
    __result
2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , can you explain with example three month retention.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi  @amitchandak 

 

 

The 33% represent customer that bought for the first time in November and came back a second time in the same month, december or January.

 
 

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