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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Syndicate_Admin
Administrator
Administrator

indefinido

¡Hola! Necesito ayuda para calcular una diferencia de tiempo entre los valores de la misma columna. He visto algunas otras publicaciones sobre el mismo tema, pero no son lo suficientemente similares a mi problema como para poder usarlas.

Tengo este extracto de un gran conjunto de datos

EVENTDATE_LOCALFECHA/HORAREPORT_TYPEVOYNUMPOSICIÓNPosition_Custom
14.03.2024 22:0014.03.2024 22:00Llegada132Arr. JEBEL ALIJEBEL ALI
17.03.2024 04:4217.03.2024 04:42Llegada132Arr. ABU DHABIABU DHABI
21.03.2024 09:0021.03.2024 09:00Llegada132Arr. MUMBAIMUMBAI
29.03.2024 08:0029.03.2024 08:00Llegada132Arr. SINGAPURSINGAPUR
16.03.2024 23:5416.03.2024 23:54Salida132DEP. JEBEL OJEBEL ALI
18.03.2024 05:3018.03.2024 05:30Salida132Dep. ABU DHABIABU DHABI
22.03.2024 17:3022.03.2024 17:30Salida132Dep. MUMBAIMUMBAI
30.03.2024 10:4830.03.2024 10:48Salida132Dep. SINGAPURSINGAPUR

Me gustaría crear una nueva columna que calcule el tiempo entre la llegada y la salida si el VOYNUM y el Position_Custom es el mismo. ¡Sería genial si alguien tiene alguna idea!

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Hola @palnarum ,

Crear columna de cálculo.

Time Difference =

VAR CurrentRowDate = 'Table'[EVENTDATE_LOCAL]

VAR CurrentVOYNUM = 'Table'[VOYNUM]

VAR CurrentPosition = 'Table'[Position_Custom]

VAR DepartureDate =

    CALCULATE(

        MIN('Table'[EVENTDATE_LOCAL]),

        FILTER(

            'Table',

            'Table'[VOYNUM] = CurrentVOYNUM

            && 'Table'[Position_Custom] = CurrentPosition

            && 'Table'[REPORT_TYPE] = "Departure"

            && 'Table'[EVENTDATE_LOCAL] > CurrentRowDate

        )

    )

RETURN

IF('Table'[REPORT_TYPE] = "Arrival" && NOT(ISBLANK(DepartureDate)),

    DATEDIFF(CurrentRowDate,DepartureDate,HOUR) / 24,

    BLANK()

)

vkaiyuemsft_0-1716514455734.png

Si su período actual no se refiere a esto, por favor aclárelo en una respuesta de seguimiento.

Saludos

Clara Gong

Si esta publicación ayuda, considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Gracias Clara

Desafortunadamente, tengo un modelo DirectQuery y recibo el mensaje de error que indica que la función CALCULATE no está permitida. También traté de usar la fórmula como medida, pero parece que el problema es que no se puede determinar un solo valor para la columna 'EVENTDATE_LOCAL' en 'Tabla'. No estoy muy seguro de cómo proceder.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.

Top Kudoed Authors