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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

v-shex-msft
Community Support
Community Support

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

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

View solution in original post

5 REPLIES 5
v-shex-msft
Community Support
Community Support

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

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

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


@ 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!:
The Definitive Guide to Power Query (M)

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

@ 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!:
The Definitive Guide to Power Query (M)

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)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.