Forum Discussion
GuidoPinares
3 years agoHelper I
Searching a Previous date
Hi community, This probably is a very easy problem but I am strugling with it, I hope you can help me. Basically I have two different Tables: Sales(CustomerID, DateSold) Activities(Custo...
- 3 years ago
GuidoPinares , NEw column
Activities Before= var _cnt = countx(Activies, Sales[Customer ID]=Activies[Customer ID] && Activies[Activity Date] <= Sales[Date Sold]) , Activies[Customer ID] )
return
if(isblank(_cnt), false(), true ())
First Purchase = var _date = minx(filter(Sales, Sales[Customer ID]= earlier(Sales[Customer ID])), Sales[Date Sold])
return
if(Sales[Date Sold] =_date, TRUE(), FALSE())
GuidoPinares
3 years agoHelper I
Thanks so much amitchandak, I think other approach for the ACtivities before could be
Activities Before=
var _cnt2 = COUNTROWS(FILTER(Activities, Sales[PrescriberNPI] = Activities[new_cnpi] && Activities[Date] <= Sales[DateSold] && Activities[Date] >= (Sales[DateSold]-90)))
return
if(_cnt2>0, TRUE(), FALSE())