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
Tan_Bui
New Member

WTD El año pasado

Estimados expertos,

He utilizado esta función para WTD este año y funciona perfectamente.

Intenté esto a WTD el año pasado y siempre vuelve en blanco. Luego traté de eliminar el último fitler Date < Sameday el año pasado, mostró las ventas totales de toda la misma semana el año pasado no el WTD.

¿Puedes ayudarme a aconsejarme sobre esto? ¿Dónde hice mal?

WTD LY.png

Muchas gracias por tu ayuda.

5 REPLIES 5
v-gizhi-msft
Community Support
Community Support

Hola

Por favor, siga estos pasos:

1)Crear una columna WeekNum:

WeekNum = WEEKNUM('Table'[Date])

2)Pruebe estas dos medidas:

WTD(Current Year) = 
IF (
    YEAR ( MAX ( 'Table'[Date] ) ) = YEAR ( TODAY () ),
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[WeekNum] IN FILTERS ( 'Table'[WeekNum] )
                && 'Table'[Date] <= MAX ( 'Table'[Date] )
        )
    )
)
WTD(Last Year) = 
IF (
    YEAR ( MAX ( 'Table'[Date] ) )
        = YEAR ( TODAY () ) - 1,
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[WeekNum] IN FILTERS ( 'Table'[WeekNum] )
                && 'Table'[Date] <= MAX ( 'Table'[Date] )
        )
    )
)

3)El resultado muestra:

11.PNG

Vea mi archivo pbix adjunto.

Saludos

Giotto

@v-gizhi-msft muchas gracias por sus instrucciones exhaustivas, incluyendo el archivo pbix. Te lo agradezco.

Sin embargo, utilicé la tarjeta para mostrar el último año WTD y se mostraría en blanco.

Hola

Por favor, intente esto:

WTD(Last Year) = 
SUMX (
    DISTINCT ( 'Table'[Date] ),
    CALCULATE (
        IF (
            YEAR ( MAX ( 'Table'[Date] ) )
                = YEAR ( TODAY () ) - 1,
            CALCULATE (
                SUM ( 'Table'[Value] ),
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    'Table'[WeekNum] IN FILTERS ( 'Table'[WeekNum] )
                        && 'Table'[Date] <= MAX ( 'Table'[Date] )
                )
            )
        )
    )
)

El resultado muestra:

1.PNG

Vea mi archivo pbix adjunto.

Saludos

Giotto

amitchandak
Super User
Super User

@Tan_Bui , consulte mi blog. No tengo el año pasado allí, pero se puede probar estos dos cálculos

https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...

LYWTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52) && 'Date'[Weekday] <=max('Date'[Weekday])))
Or
LYWTD = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]=(max('Date'[Year]) -1)
 && 'Date'[Week Number]=(max('Date'[Week Number]))
 && 'Date'[Weekday] <=max('Date'[Weekday])))

Por favor, vea/me gusta/comparte mi seminario web sobre Time Intelligence: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...
Mis consejos de Youtube en: https://www.youtube.com/playlist?list=PLPaNVDMhUXGYrm5rm6ME6rjzKGSvT9Jmy

Aprecia tus Felicitaciones.

Muchas gracias. Usé una de tus soluciones y funcionó

LYWTD ? CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Year]-(max('Date'[Year]) -1)
 && 'Date'[Week Number]-(max('Date'[Week Number]))
 && 'Date'[Weekday] <-max(Date'))))))))))))))))))))))))))))))))))))))))"&&Date'[Weekday'

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.