Forum Discussion

ChrisCollao's avatar
ChrisCollao
Frequent Visitor
2 years ago
Solved

Count machinery splitted stops

Hi all,   I have this sort of data:   Machine Start datetime End datetime Machine1 2023-12-01 13:00:00 2023-12-02 00:00:00 Machine2 2023-12-02 11:00:00 2023-12-02 15:00:00 Machi...
  • ChrisCollao's avatar
    ChrisCollao
    2 years ago
    Sorry mom, I used GPT.

     

    I used GPT to see another solution and to not use an iterative DAX formula. This was the result:

    ColumnaMarcador = 
    VAR MaquinaActual = Detenciones[Maquina]
    VAR FechaHoraInicioActual = Detenciones[FechaHoraInicio]
    VAR FechaHoraFinAnterior =
    MAXX(
    FILTER(
    Detenciones,
    Detenciones[Maquina] = MaquinaActual &&
    Detenciones[FechaHoraFin] < FechaHoraInicioActual
    ),
    Detenciones[FechaHoraFin]
    )
    RETURN
    IF(
    NOT ISBLANK(FechaHoraFinAnterior) &&
    FechaHoraFinAnterior = FechaHoraInicioActual,
    1,
    0
    )

     

    It's amazing that the first GPT solution was pretty similar to the one presented by Fowmy, but with the instruction of the out of memory error it managed it to make a non interative solution.

     

    If anyone needs the prompt and chat (in spanish), here is: https://chat.openai.com/share/cc6d9a4f-9169-410c-b89c-08f61eeb44cb

     

    Best regards.