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

valor de búsqueda dentro del intervalo de fechas

Escenario

Agregar una columna con Rol a la tabla de hojas de horas.

Cada empleado tiene un rol, que cambiará con el tiempo. Quiero buscar el rol del empleado en función de la fecha del parte de horas. El rol correcto se puede encontrar mirando la fecha del parte de horas. esta fecha debe estar en el intervalo de fechas de la tabla de roles de empleado.

Pregunta

¿Qué expresión se necesita?

Timesheets

Empleado

Fecha

John

1-3-2019

John

1-3-2020

Chris

1-8-2019

Chris

1-9-2019

Rol de empleado

Empleado

Papel

Fecha de inicio

Fecha de finalización

John

Personal medior

1-1-2019

31-12-2019

John

Personal superior

1-1-2020

31-12-2020

Chris

Personal junior

1-6-2019

31-12-2019

Cristo

Personal medior

1-1-2020

31-12-2019

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

@rbontje Estás buscando una búsqueda aproximada. Mira si este post ayuda a:

https://excelwithallison.blogspot.com/2020/06/dax-approximate-lookup.html

Utilice la medida y edición "bonus between" para sus datos:

Bonificación entre los números de los que se de
CALCULAR (
SELECTEDVALUE ( EmployeeRole[Role] ),
FILTRO (
EmployeeRole,
EmployeeRole[Fecha de inicio] < SELECTEDVALUE(Hojas de horas[Fecha]
&& EmployeeRole[Fecha de finalización] > SELECTEDVALUE(Hojas de horas[Fecha]
)
)

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

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

¡Gracias a los dos!

Allison es la ganadora 🙂

He hecho un pequeño ajuste para incluir también los resultados que están en la fecha de inicio o finalización. Esto no se mencionó claramente en mi primer post. < y > se reemplazan por < y > .

Variable ?
CALCULAR (
SELECTEDVALUE ( EmployeeRole[Role] ),
FILTRO (
EmployeeRole,
EmployeeRole[Fecha de inicio] <- SELECTEDVALUE(Hojas de horas[Fecha]
&& EmployeeRole[Fecha de finalización] >SELECTEDVALUE(Hojas de horas[Fecha]
)
)
amitchandak
Super User
Super User

@rbontje , Una nueva columna en el parte de horas para obtener el rol

nueva columna ?
maxx(filter('Employee Role', 'Employee Role'[Start Date] <'Timesheets[Date] && 'Employee Role'[End Date] >'Timesheets[Date]
&& 'Rol de empleado'[Empleado] ?Hojas de horas[Empleado]),'Rol de empleado'[Rol])

AllisonKennedy
Super User
Super User

@rbontje Estás buscando una búsqueda aproximada. Mira si este post ayuda a:

https://excelwithallison.blogspot.com/2020/06/dax-approximate-lookup.html

Utilice la medida y edición "bonus between" para sus datos:

Bonificación entre los números de los que se de
CALCULAR (
SELECTEDVALUE ( EmployeeRole[Role] ),
FILTRO (
EmployeeRole,
EmployeeRole[Fecha de inicio] < SELECTEDVALUE(Hojas de horas[Fecha]
&& EmployeeRole[Fecha de finalización] > SELECTEDVALUE(Hojas de horas[Fecha]
)
)

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.