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! Learn more

Reply
Anonymous
Not applicable

Calculate active customers whose last sale was in last 12 months

Trying to work out number of active customers checking if their lapsed date has been reached. Lapsed date is when there is no order for customer in last 12 months

 

# Active Cust = 
VAR dt =
    CALCULATE (
        MAX ( 'Calendar'[Date] ),
        ALLSELECTED ( 'Calendar'[Date] )
    )

VAR ActiveCustomers =
    ADDCOLUMNS (                            
        VALUES ( Sales[Sell-to Customer No_] )
        ,"@LapsedDate", [CustomerLapsedDate] ) -- measure lasped date , last order date + 12 months

var __activeCusts =
COUNTROWS (
    DISTINCT (
            FILTER ( ActiveCustomers, [@LapsedDate] > dt)
        )
)
return  __activeCusts

 

 

Desired Result with correct active customers, the total is actually correct as it stand 33 customers have not lasped. However I want this view at month level. So June should show 33

 active.JPG

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

 

Solved it in the end, was simply this!

 

# Active Customers = 
VAR EndDate = MAX('Calendar'[Date])
VAR StartDate =EDATE(EndDate,-12)
VAR Result = 
CALCULATE(
[# Customers],DATESBETWEEN(Calendar[date],StartDate,EndDate)
)

RETURN
    IF (Result = BLANK(), 0, Result)

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

 

Solved it in the end, was simply this!

 

# Active Customers = 
VAR EndDate = MAX('Calendar'[Date])
VAR StartDate =EDATE(EndDate,-12)
VAR Result = 
CALCULATE(
[# Customers],DATESBETWEEN(Calendar[date],StartDate,EndDate)
)

RETURN
    IF (Result = BLANK(), 0, Result)

 

Anonymous
Not applicable

Can i include anything extra to help arrive at a solution, new to psoting on the forum thanks?

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.