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

La función DATEADD no funciona bien con el filtro.

Hola a todos

Tengo un requisito para calcular los datos que duran algunos días. Exploré y usé la función DATEADD.

También tengo algún filtro en mis datos, después de aplicar, asumí que funcionaba bien con el filtro o no.

Pero cuando tengo prueba con filtro, la medida con DATEADD parecía que no había cambiado.

¿Alguien puede explicarme o darme una solución de esto?

Gracias.

3 ACCEPTED SOLUTIONS
az38
Community Champion
Community Champion

Hola @Thai_Nguyen96

dateadd() es una función muy complicada

según https://docs.microsoft.com/en-us/dax/dateadd-function-dax

The result table includes only dates that exist in the dates column.

If the dates in the current context do not form a contiguous interval, the function returns an error.

por lo tanto, si su modelo de datos no garantiza la continción de fechas es mejor utilizar declaraciones como

Table[Date] + 90

o para crear una tabla de calendario para cálculos más complicados


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

amitchandak
Super User
Super User

@Thai_Nguyen96 , como se explica en @az38 no se puede utilizar dateadd. También sugirió la solución. También puede crear una fecha de adición como esta

Nueva fecha: fecha(año(tabla[fecha])+0,mes(tabla[fecha])+0,día(tabla[fecha])+0)

+0 es lo que se ha reemplazado en año, mes o fecha

Para añadir 7 días

Nueva fecha: fecha (año (tabla[fecha]),mes (tabla[fecha]),día (tabla[fecha])+7)

Para añadir 7 Meses

Nueva fecha: fecha(año(tabla[fecha]),mes(tabla[fecha])+7,día(tabla[fecha]))

También puede agregar más de 12 meses

View solution in original post

v-xuding-msft
Community Support
Community Support

Hola @Thai_Nguyen96 ,

Agrego algunos blogs y vídeos a los que podrías hacer referencia para aprender más sobre la función de DATEADD.

Uso de DATEADD() y otras sugerencias de fecha para filtrar datos en Power BI

La función DATEADD: la mejor y más versátil función de inteligencia de tiempo en Power BI

Función DATEADD (DAX): función DAX DATEADD en Power BI Desktop

#16 de los viernes de DAX: DATEADD

Saludos

Xue Ding

Si este post Ayuda, entonces por favor considereAcéptelo como la soluciónpara ayudar a los otros miembros a encontrarlo más rápidamente.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-xuding-msft
Community Support
Community Support

Hola @Thai_Nguyen96 ,

¿Tienen sentido estas respuestas? Si es así, marque las respuestas útiles como las soluciones. Entonces podremos cerrar el caso. Más gente se beneficiará de aquí. Gracias de antemano.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-xuding-msft
Community Support
Community Support

Hola @Thai_Nguyen96 ,

Agrego algunos blogs y vídeos a los que podrías hacer referencia para aprender más sobre la función de DATEADD.

Uso de DATEADD() y otras sugerencias de fecha para filtrar datos en Power BI

La función DATEADD: la mejor y más versátil función de inteligencia de tiempo en Power BI

Función DATEADD (DAX): función DAX DATEADD en Power BI Desktop

#16 de los viernes de DAX: DATEADD

Saludos

Xue Ding

Si este post Ayuda, entonces por favor considereAcéptelo como la soluciónpara ayudar a los otros miembros a encontrarlo más rápidamente.

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

@Thai_Nguyen96 , como se explica en @az38 no se puede utilizar dateadd. También sugirió la solución. También puede crear una fecha de adición como esta

Nueva fecha: fecha(año(tabla[fecha])+0,mes(tabla[fecha])+0,día(tabla[fecha])+0)

+0 es lo que se ha reemplazado en año, mes o fecha

Para añadir 7 días

Nueva fecha: fecha (año (tabla[fecha]),mes (tabla[fecha]),día (tabla[fecha])+7)

Para añadir 7 Meses

Nueva fecha: fecha(año(tabla[fecha]),mes(tabla[fecha])+7,día(tabla[fecha]))

También puede agregar más de 12 meses

az38
Community Champion
Community Champion

Hola @Thai_Nguyen96

dateadd() es una función muy complicada

según https://docs.microsoft.com/en-us/dax/dateadd-function-dax

The result table includes only dates that exist in the dates column.

If the dates in the current context do not form a contiguous interval, the function returns an error.

por lo tanto, si su modelo de datos no garantiza la continción de fechas es mejor utilizar declaraciones como

Table[Date] + 90

o para crear una tabla de calendario para cálculos más complicados


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

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.