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
dats
Resolver I
Resolver I

Inclusión de la semana en SamePeriodLastyear

Hola a todos

Tengo un problema con el formulario DAX 'Sameperiodlastyear'. mi tabla de datos inicial se ve algo como esto:

FechaInicio de la semanaañoSemanaVentas
19.05.201914.05.20192019201
20.05.201920.05.20192019212
...............

Tiene toda la semana desde 01.01.2018 (semana uno de 2018) hasta 17.05.2020 (semana 2020)

Además, de la misma tabla recuperaré la suma total de las ventas. Ahora me gustaría crear una tabla que tenga este aspecto:

añoTotal de VentasSamePeriodesaño pasado
2018500
20191000500
20202001000

Pero lo que recibo es esto:

añoTotal de VentasSamePeriodesaño pasado
2018500500
20191000300
2020200

Los 300 y 500 son los problemas aquí. Para 2020 mis datos incluyen ventas incluyendo la semana 20. Así que esperaría que la misma función de período del año pasado también mostrar sólo las primeras 20 semanas. Pero por alguna razón incluye 22 semanas.

Mis formularios son Total SUMX(Category,Category[Value])y CALCULATE( [total]; SAMEPERIODLASTYEAR(Date;Date[StartofWeek])

Ho das powerbi se da cuenta de la

lo que podría ser el tema tah powerbi incluye 22 semanas para 2019 en lugar de 20 y ho puedo mostrar el número para 2019 en 2020 ,..

Saludo

1 ACCEPTED SOLUTION

@Greg_Deckler Gracias por la propina. Lo intentaré más tarde.

Encontré otra forma de funcionar también.

weeklysales á calculate([ValueTotalCategory]; Filter(ALL('Date');' Fecha'[CalendarYear]-SELECTEDVALUE('Date'[CalendarYear])-1 && 'Date'[Week]-SELECTEDVALUE('Date'[Week])))

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@dats - Mira si mi Inteligencia del Tiempo el Camino Difícil proporciona una manera diferente de lograr lo que estás buscando.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler Gracias por la propina. Lo intentaré más tarde.

Encontré otra forma de funcionar también.

weeklysales á calculate([ValueTotalCategory]; Filter(ALL('Date');' Fecha'[CalendarYear]-SELECTEDVALUE('Date'[CalendarYear])-1 && 'Date'[Week]-SELECTEDVALUE('Date'[Week])))

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.