cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SLima
Frequent Visitor

Customers do not buy "x" Months (parameter)

I created this measure to select customers who are not buying at "x" (parameter) month.

it's not working.

 

measure =
VAR vParametro=ParamMeses[ParamMeses Valor]
VAR _Data = MIN(dCalendarioCliente[Date])
VAR Mes_Anterior = EDATE(_Data, vParametro)
VAR Clientes_Compraram_Mes_Atual =
VALUES(fVendasProduto[IDCLIENTE])
VAR Clientes_Compraram_MesParam =
CALCULATETABLE(
VALUES(fVendasProduto[IDCLIENTE]),
dCalendarioCliente[Date] < _Data &&
dCalendarioCliente[Date] >= Mes_Anterior
//DATEADD(dCalendarioCliente[Date],vParametro,MONTH)
)
VAR _Except =
EXCEPT(Clientes_Compraram_Mes_Atual,Clientes_Compraram_MesParam )
VAR Resultado =
CALCULATE(
[Total de Vendas Analise Clintes],
KEEPFILTERS(_Except)
)
RETURN
Resultado

Thanks in advance.

 

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@SLima , Try a measure like

 

measure =
VAR vParametro=ParamMeses[ParamMeses Valor]
VAR _max = MAXX(allselected(dCalendarioCliente),dCalendarioCliente[Date])
VAR _min = date(year(_max), month(_max) -1* vParametro, 1) 4
var _m1 =calculate([Total de Vendas Analise Clintes], filter(dCalendarioCliente, dCalendarioCliente[Date] >=_min && dCalendarioCliente[Date] <=_max))
return
countx(VALUES(fVendasProduto[IDCLIENTE]), if(isblank(_m1), [IDCLIENTE], blank()))

 

 



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Does not work.
I need it to show only customers who didn't buy x (parameter) month last.

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!