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 IV
Super User IV

@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
MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

July 2021 Update 768x460.png

Check it out!

Click here to read more about the July 2021 Updates

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Top Solution Authors