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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply

QUARTELY COHORT ANALYSIS?

I have a cohort analysis which is typically montly. 

My boss wants it quarterly. 
I created calculated column to group our customers : 

(DATE) ORDER QUARTER & YEAR =

VAR _FirstOrderDate = CALCULATE(
MIN(orders[time_dropoff_id]),
FILTER(
ALL(orders),
orders[customer_id] = EARLIER(orders[customer_id]) &&
NOT orders[order_status_code] IN {7, 10, 2.5}
)
)
VAR _Year = YEAR(_FirstOrderDate)
VAR _Quarter = QUARTER(_FirstOrderDate)
VAR _MonthEndOfQuarter = _Quarter * 3
VAR _LastDayOfQuarter = EOMONTH(DATE(_Year, _MonthEndOfQuarter, 1), 0)
RETURN _LastDayOfQuarter


I created series that will serve as my column 

Quarter_After = GENERATESERIES( 0, 1000, 1 )


I need DAX where I want know how many from cohort  0 is left quarter by quarter similar to my monthly cohort :


Screenshot 2024-05-03 154859.png



 My monthly cohort retention dax is like this: 


Current Retention Value =
VAR currentMonthsAfter = SELECTEDVALUE('Months after'[Value])
VAR currentfirstordermonth = SELECTEDVALUE( orders[(DATE) FirstOrderMonthYear])

RETURN

    CALCULATE(
        DISTINCTCOUNT( orders[customer_id] ),
        FILTER(
            orders ,
            EOMONTH( orders[time_dropoff_id].[Date] , 0 ) = EOMONTH( currentfirstordermonth , currentMonthsAfter )))
 




1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @Andrew_na_lang ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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