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
jcawley
Helper III
Helper III

¿Fecha máxima antes de un rango filtrado?

Hola

Estoy tratando de ver cuántos clientes han venido durante el último mes (o cualquier rango filtrado realmente) que tienen una cita completa, que han comprado algo previamente de nosotros, y que no han estado en nuestra oficina en los últimos 365 días (en relación con cualquier rango de fechas filtrada).

Tengo dos mesas. Una tabla (1) muestra todos los clientes que han comprado un artículo y otra tabla (2) que muestra todas las fechas en las que un cliente ha venido a la tienda.

Tabla 1

Id
12345
23456

Tabla 2

IdTipoFechaCompletado
12345Chequeo06/01/2014
12345Chequeo06/28/2020
23456Chequeo06/01/2014
23457Chequeo06/01/2020No


Hasta ahora traté de utilizar lo siguiente como sugiere @AllisonKennedy:

Fecha de visita anterior: MAXX(FILTER(Table2, Table2[Date]<EARLIER(Table2[Date])),Table2[Date])
- No puedo conseguir esto para escupir la información correcta. Da fechas, pero no parece ser específica de ID
Comprado: IF(COUNTROWS(RELATEDTABLE(Table1))>0,"Yes","No")
A continuación, cree un MEASURE para determinar si son su cliente clave o no:
KeyClient ? IF(DATEDIFF(SELECTEDVALUE(Table2[Previous Visit Date]),MIN(DimDate[Date]),DAY)>365&&SELECTEDVALUE(Table2[Completed])"Yes" && SELECTEDVALUE(Table2[Purchased])"Yes","Yes", "No")

- ¡No puedo conseguir que esta medida me dé un recuento!


Cualquier ayuda sería muy apreciado!

2 REPLIES 2
AllisonKennedy
Super User
Super User

Además, lo siento pensé que lo había actualizado, pero pruebe esta versión actualizada de la fecha de visita anterior que comprueba el ID:
Fecha de la visita anterior: MAXX(FILTER(Table2,Table2[ID]-EARLIER(Table2[ID]) &&Table2[Date]<EARLIER(Table2[Date])),Table2[Date])

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

AllisonKennedy
Super User
Super User

¿Puede proporcionar una muestra de la salida deseada? La medida que sugerí funciona si tienes ID en el objeto visual, pero si no vas a tener ID en ese objeto visual podrías probar una variación de lo que sugerí en tu otro post, solo usando un COUNTROWS(FILTER(Table1, ...

Tendrá que agregar ligeramente las funciones de filtro en consecuencia para que hablen con los datos de Table1 en función de sus relaciones. Tampoco necesitarás el filtro para Purchased""Yes" ya que Table1 ya lo hace por ti.

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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.