Forum Discussion

AnthonyJ's avatar
AnthonyJ
Frequent Visitor
3 years ago
Solved

Subsetting Query in DAX

Hi, I've looked around the internet and aren't able to see a comment on what I'm trying to achieve so I'm hoping someone will be able to to tell me if this is possible in a DAX measure.   By way o...
  • amitchandak's avatar
    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