Forum Discussion
Subsetting Query in DAX
- 3 years ago
AnthonyJ , You just need two measure purchases in 5 months not in 6th ,
if based on rolling
refer
Power BI- Customer Purchasing in each of the last 3 months: https://youtu.be/bGtjoccEA38
same as lost customer here
Period over Period Retention :https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retention/ba-p/1377458
Or use meausre like
Calculate(Sum(Table[Value]), filter('Date', month('Date'[Date]) <5 ))
Calculate(Sum(Table[Value]), filter('Date', month('Date'[Date]) = 6 ))
or use all
Calculate(Sum(Table[Value]), filter(all('Date'), month('Date'[Date]) <5 ))
Calculate(Sum(Table[Value]), filter(('Date') , month('Date'[Date]) = 6 ))
based on selected date or today
or use all
first 5 =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())var _max = eomonth(_max1,(-1*MONTH(_max1)) +5 )
var _min = eomonth(_max1,-1*MONTH(_max1))+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))6th =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())var _max = eomonth(_max1,(-1*MONTH(_max1)) +6 )
var _min = eomonth(_max1,(-1*MONTH(_max1)) +5 ) +1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))With any set of measure , follow lost customer logic give in blog and video
AnthonyJ , You just need two measure purchases in 5 months not in 6th ,
if based on rolling
refer
Power BI- Customer Purchasing in each of the last 3 months: https://youtu.be/bGtjoccEA38
same as lost customer here
Period over Period Retention :https://community.powerbi.com/t5/Community-Blog/Customer-Retention-Part-2-Period-over-Period-Retention/ba-p/1377458
Or use meausre like
Calculate(Sum(Table[Value]), filter('Date', month('Date'[Date]) <5 ))
Calculate(Sum(Table[Value]), filter('Date', month('Date'[Date]) = 6 ))
or use all
Calculate(Sum(Table[Value]), filter(all('Date'), month('Date'[Date]) <5 ))
Calculate(Sum(Table[Value]), filter(('Date') , month('Date'[Date]) = 6 ))
based on selected date or today
or use all
first 5 =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _max = eomonth(_max1,(-1*MONTH(_max1)) +5 )
var _min = eomonth(_max1,-1*MONTH(_max1))+1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
6th =
var _max1 = if(isfiltered('Date'),MAX( 'Date'[Date]) , today())
var _max = eomonth(_max1,(-1*MONTH(_max1)) +6 )
var _min = eomonth(_max1,(-1*MONTH(_max1)) +5 ) +1
return
CALCULATE([net] ,DATESBETWEEN('Date'[Date],_min,_max))
With any set of measure , follow lost customer logic give in blog and video