Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Encuentre a los clientes por un período de tiempo no en los últimos años

Hola a todos,
Estoy trabajando en un escenario como este. Tengo un conjunto de datos donde guardo los nombres y las fechas de los clientes que vienen a mi tienda.
Quiero agregar otra columna a este conjunto de datos y buscar lo siguiente para la fila correspondiente.
Clientes que vinieron a mi tienda antes de un año, pero no en el último año. (tampoco es la primera vez)

Creo que el algoritmo debería ser así, pero no tengo idea de cómo debería ser en dax,

Si la fila es clientes sólo registro --> 0

Else If Customer First Time --> 0

Else Si el Cliente tiene otro registro en el último 1 año --> 0

Else 1

El resultado esperado debería ser como el siguiente.
Customer_1_Year.png
No tengo idea de cómo puedo hacer esto.
¿Puede alguien ayudarme?
PBIX

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@mnstklm33

tal vez usted puede tratar de crear una columna

Column = 
VAR a=CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[date]<EARLIER('Table'[date])&&'Table'[customer]=EARLIER('Table'[customer])))
VAR b=CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[date]<EARLIER('Table'[date])&&'Table'[date]>=EDATE(EARLIER('Table'[date]),-12)&&'Table'[customer]=EARLIER('Table'[customer])))
return if(ISBLANK(a)||b>0,0,1)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@mnstklm33

tal vez usted puede tratar de crear una columna

Column = 
VAR a=CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[date]<EARLIER('Table'[date])&&'Table'[customer]=EARLIER('Table'[customer])))
VAR b=CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[date]<EARLIER('Table'[date])&&'Table'[date]>=EDATE(EARLIER('Table'[date]),-12)&&'Table'[customer]=EARLIER('Table'[customer])))
return if(ISBLANK(a)||b>0,0,1)

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

@ryan_mayu
Absolutamente trabajando bien.
No puedo agradecerte lo suficiente..
Muchas gracias

@mnstklm33

De nada.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.