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

Moving Range con el tiempo

Estoy tratando de obtener el tiempo de una fila a la siguiente para determinar cuánto tiempo ha transcurrido de cada entrada.

Actualmente estoy usando esta declaración DAX:

Moving Range = 
VAR a =
    CALCULATE (
        FIRSTNONBLANK ( Query1[Time], 1 ),
       FILTER(
        'Query1',
        'Query1'[Test]= EARLIER('Query1'[Test] - 1  ))
    )
RETURN
    IF ( a = BLANK (), BLANK(), DATEDIFF( a , Query1[Time],MINUTE))

Pero me da un error cuando lo uso. He publicado algunos datos de muestra para ayudar con esto.

El mismo día: es un índice que me indica que la entrada es el mismo día.

Prueba: es el índice de los eventos que están en el mismo día.

image.png

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hola @Coglizer,

Puede agregar una columna de índice en el Editor de consultas. A continuación, cree una columna calculada como la siguiente:

Moving Range á var pre-CALCULATE(SUM('Table'[Time]),FILTER('Table','Table'[Same Day Count]'EARLIER('Table'[Same day Count])&&'Table'[Index]'EARLIER('Table'[Index])-1))
devolver IF(pre-BLANK(),BLANK(),DATEDIFF(pre,'Table'[Time],MINUTE))

q3.PNG

Saludos
Qiuyun Yu

Community Support Team _ Qiuyun Yu
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

2 REPLIES 2
v-qiuyu-msft
Community Support
Community Support

Hola @Coglizer,

Puede agregar una columna de índice en el Editor de consultas. A continuación, cree una columna calculada como la siguiente:

Moving Range á var pre-CALCULATE(SUM('Table'[Time]),FILTER('Table','Table'[Same Day Count]'EARLIER('Table'[Same day Count])&&'Table'[Index]'EARLIER('Table'[Index])-1))
devolver IF(pre-BLANK(),BLANK(),DATEDIFF(pre,'Table'[Time],MINUTE))

q3.PNG

Saludos
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
HotChilli
Super User
Super User

Primera pregunta: ¿cuál es el error?

¿No se resalta el texto ofensivo en la fórmula?

Parece que hay un corchete fuera de lugar en la cláusula EARLIER

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.