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
Syndicate_Admin
Administrator
Administrator

Cálculo de resultados de la semana anterior en una clave de semana

Esto se ha pedido a muerte, pero ninguna de las soluciones anteriores parece funcionar para mí, por favor, ayuda.

Mi métrica se agrupa por etiqueta de fin de semana en la tabla de calendario (WE2019-07-05, por ejemplo).

En mi tabla de calendario tengo la etiqueta y las claves de etiqueta para el fin de semana, así:

MightyMicrobe_1-1623592459334.png

Estoy tratando de usar la siguiente fórmula que no funciona. ¿Qué estoy haciendo mal?

Visits PW = 
CALCULATE(
    [Total Visits],
    FILTER(
        ALL('Calendar'), 
        'Calendar'[Week Ending Date Key] = 'Calendar'[Week Ending Date Key] - 1
    )
)

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

No @MightyMicrobe

Debe modificar la medida para:

Visits PW =
VAR WeekEndingDateKey = MIN('Calendar'[Week Ending Date Key])
RETURN
CALCULATE(
    [Total Visits],
    FILTER(
        ALL('Calendar'), 
        'Calendar'[Week Ending Date Key] = WeekEndingDateKey - 7
    )
)

Si todavía tienes alguna pregunta, por favor no dudes en hacérmelo saber.

Saludos

enlace

¿Es esa la respuesta que estás buscando? Si este post ayuda, entonces por favor considere Aceptarlo como la solución. Realmente apreciar!

View solution in original post

4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

No @MightyMicrobe

Debe modificar la medida para:

Visits PW =
VAR WeekEndingDateKey = MIN('Calendar'[Week Ending Date Key])
RETURN
CALCULATE(
    [Total Visits],
    FILTER(
        ALL('Calendar'), 
        'Calendar'[Week Ending Date Key] = WeekEndingDateKey - 7
    )
)

Si todavía tienes alguna pregunta, por favor no dudes en hacérmelo saber.

Saludos

enlace

¿Es esa la respuesta que estás buscando? Si este post ayuda, entonces por favor considere Aceptarlo como la solución. Realmente apreciar!

Syndicate_Admin
Administrator
Administrator

@MightyMicrobe , debido a que para cada fila de una tabla hay una condición de comprobación:

'Calendar'[Week Ending Date Key] = 'Calendar'[Week Ending Date Key] - 1

Por ejemplo, 'Calendar'[Week Ending Date Key] = 20190712, entonces la condición será

20190712 = 20190712 - 1

Por lo tanto, siempre es FALSE para cada fila de la tabla.
solución:

Visits PW =
VAR WeekEndingDateKey = MIN('Calendar'[Week Ending Date Key])
RETURN
CALCULATE(
    [Total Visits],
    FILTER(
        ALL('Calendar'), 
        'Calendar'[Week Ending Date Key] = WeekEndingDateKey - 1
    )
)

Gracias por esto. Probé la solución, y aunque no hay errores, la fórmula devuelve espacios en blanco en la matriz.

MightyMicrobe_0-1623631484784.png

@MightyMicrobe, ¡uy!

'Calendar'[Week Ending Date Key] = WeekEndingDateKey - 7

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.