Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Buenas.
Estoy intentando restar dos fechas, pero no puedo, ya que al crear la medida no me muestra los campos fecha de la tabla que necesito, mi medida seria :
diferencia = DATEDIFF( Dcontratos[DESDE]:, Dcontratos[HASTA], DAY)
En la siguiente captura se puede ver como tengo definido las fechas:
Formato
al crear la medida no me aparece el campo DESDE:
Estructura y representación
Que falla?
Muchas gracias.
Solved! Go to Solution.
@Syndicate_Admin No, me refiero a algo como esto:
diff_measure=var startDate=MIN([SINCE:])
var endDate=MAX([HASTA:])
return DATEDIFF(startDate,endDate,DAY)
Variables startDate y endDate se pueden definir de cualquier otra manera. Pero usando variables no necesitas la función DATEDIFF para restar dos fechas, simplemente puedes restar esas variables:
diff_measure=var startDate=MIN([SINCE:])
var endDate=MAX([HASTA:])
return endDate-startDate
@Syndicate_Admin En la función DATEDIFF tienes que usar fechas de un solo valor en lugar de columnas de fecha. Utilice la variable para definir las fechas de inicio/finalización y, a continuación, utilí sus usos en la función.
Buenas te refieres a esto:
Es que lo pongo asi, pero sigue sin dejarme.
@Syndicate_Admin No, me refiero a algo como esto:
diff_measure=var startDate=MIN([SINCE:])
var endDate=MAX([HASTA:])
return DATEDIFF(startDate,endDate,DAY)
Variables startDate y endDate se pueden definir de cualquier otra manera. Pero usando variables no necesitas la función DATEDIFF para restar dos fechas, simplemente puedes restar esas variables:
diff_measure=var startDate=MIN([SINCE:])
var endDate=MAX([HASTA:])
return endDate-startDate
Hola mi problema es al elegir el formato del dato de la medida. No me deja elegir más que fechas. No números ¿me podéis ayudar?
Resuelto con Convert (Date, Integer)
OK, me alegro.
Has probado a cambiar el tipo de dato a numero, desde Power Query?
Muchas gracias, me ha funcionado, finalmente he usado el today en Star para calcular a dia de hoy.
Un saludo
Ya esta aceptada.
Un saludo
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.