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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Active / LeavingCustomers Measures

Hello, 

 

I am creating column chart by years/yearmonths with customers segmented by their activity:

 

Active Customer:  customer has status 'active'  up to 15 month after his order.  Measure is OK

Leaving Customer: this 'status' customer acquires when it is exactly 16 months (not 17 and more) after his last order and he is not in 'active' status. Need help with this

 

Active Customer is calculated below. However i need help with calculation of Leaving Customer

 

For calculating active customers in selected period (15 months after each order) I was following this guide:

active rows

 

Source table structure:

CustomerEmailPurchaseDateUntill 15M (calculated column)
customer12018-01-012019-04-01
customer12018-06-012019-09-01
customer22016-01-012017-04-01
customer22020-01-012021-04-01

 

 

 

ActiveCustomer_tmp_measure_TotalRows:
=DISTINCTCOUNT(ActiveCustomer[CustomerEmail])
ActiveCustomers Last15M:=
CALCULATE([ActiveCustomer_tmp_measure_TotalRows];
	FILTER(ActiveCustomer;
		(ActiveCustomer[PurchaseDate]<=LASTDATE('Calendar'[Date])
		&&
		ActiveCustomer[Untill 15M]>=FIRSTDATE('Calendar'[Date]))))

 

 

 

Thanks!

 

2 ACCEPTED SOLUTIONS

@Anonymous - Try this out:

Leaving Customers =
  VAR __Today = TODAY()
  VAR __Table = 
    ADDCOLUMNS(
      ADDCOLUMNS(
        SUMMARIZE('Table',[CustomerEmail],"End15",MAX([Until 15M])),
        "16",EOMONTH([End15,1])
      ),
      "Leaving",IF(__Today > [End15] && __Today <=[16],1,0)
    )
RETURN
  COUNTROWS(FILTER(__Table,[Leaving]=1))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Anonymous
Not applicable

Hi @Anonymous,

I'd like to suggest you take a look at following link about hr employee analytic if it meet your requirement:

HR Data - Slowly Changing Dimensions 

Regards,

Xiaoxin Sheng

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous,

I'd like to suggest you take a look at following link about hr employee analytic if it meet your requirement:

HR Data - Slowly Changing Dimensions 

Regards,

Xiaoxin Sheng

Greg_Deckler
Community Champion
Community Champion

@Anonymous - Not exactly following this, so when would those customers be considered inactive?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

hello,

 

@Greg_Deckler 

active- 0 - 15

leaving - 16

inactive - 17+

 

inactive is easy to calculate as 'total cumulative' - 'active 17'

problem is just 16 months - customer gets this status when it is 16 months after his order and there were no other orders in this period

 

 

 

@amitchandak 

it doesnt' count customers but sums revenue and the second measure not works properly

@Anonymous - Try this out:

Leaving Customers =
  VAR __Today = TODAY()
  VAR __Table = 
    ADDCOLUMNS(
      ADDCOLUMNS(
        SUMMARIZE('Table',[CustomerEmail],"End15",MAX([Until 15M])),
        "16",EOMONTH([End15,1])
      ),
      "Leaving",IF(__Today > [End15] && __Today <=[16],1,0)
    )
RETURN
  COUNTROWS(FILTER(__Table,[Leaving]=1))


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@Anonymous , not very clear. if customer is inactive if he not coming for last 16 month

example - Measures

purchased in last 16 month

Rolling 16 Sales = CALCULATE(sum(Retail[Qty]),DATESINPERIOD('Date'[Date],max('Date'[Date]),-3,MONTH))

not purchsed in last 16 month
Rolling 16 Not Sold = if(CALCULATE(sum(Retail[Qty]),DATESINPERIOD('Date'[Date],max('Date'[Date]),-3,MONTH)) +0>0,blank(),1)

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

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