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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
rohanjha1988
Helper II
Helper II

Number of customers with last order date more than 100 days ago

Hi All,

 

I have a Sales table in which date wise sales is given. The table has columns such as Customer Id, Customer name, Sales Date, Sales amount, Sales executive name. I need to make a measure in which i need to count no of customers who have not ordered in last 100 days. 

 

Please help!!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@rohanjha1988 , Create a measure like this

Rolling 100 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],today(),-100,Day)) +0

 

or

 

Rolling 100 day =
var _max =maxx(allselected(Date), Date[Date])
return
CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],_max,-100,Day)) +0

 

like

 

Inactive customer = countX(filter(summarize(Customer,Customer[Customer ID],"_1",[Rolling 100 day]),[_1] >0),[Customer ID])

 

Rolling 100 day =0 means customer has no purchase in last 100 days

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@rohanjha1988 , Create a measure like this

Rolling 100 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],today(),-100,Day)) +0

 

or

 

Rolling 100 day =
var _max =maxx(allselected(Date), Date[Date])
return
CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],_max,-100,Day)) +0

 

like

 

Inactive customer = countX(filter(summarize(Customer,Customer[Customer ID],"_1",[Rolling 100 day]),[_1] >0),[Customer ID])

 

Rolling 100 day =0 means customer has no purchase in last 100 days

ryan_mayu
Super User
Super User

@rohanjha1988 

 

1.PNG

please create a measure

_num = VAR tbl=CALCULATETABLE(VALUES('Table (3)'[customer]),FILTER('Table (3)','Table (3)'[orderdate]>=(today()-100)))
VAR tbl2=VALUES('Table (3)'[customer])
return COUNTROWS(tbl2)-COUNTROWS(tbl)

2.PNG

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




AllisonKennedy
Super User
Super User

Calculate the days since last order and filter for greater than 100
https://www.youtube.com/watch?v=we32kThtuuo

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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