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

Medida YTD

Hola

Espero que te vaya bien.

¿Hay una manera analítica de filtrar los datos utilizando la inteligencia del tiempo? Quiero calcular la suma de las ventas del año pasado a partir del 1 de enero de 2019 hasta el mes completo. Vamos a fingir que todavía estamos en agosto, quiero acumular las ventas y comparar naranjas con naranjas (Ventas del 1 de enero de 2019 al 31 de agosto de 2019 vs Ventas del 1 de enero de 2020 al 31 de agosto de 2020) y hacerlo automático utilizando una tabla de calendario.

Feliz Año Nuevo.

saludos

Othman

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hola

Cree una tabla de calendario y establezca una relación desde la columna Fecha de la tabla de datos base hasta la columna de fecha de la tabla de calendario. En la tabla de calendario, escriba fórmulas de columna calculadas para extraer el año, el nombre del mes y el número de mes. Ordene la columna Nombre del mes por número de mes. Cree 2 segmentaciones de datos: una para Year y otra para Month Name. En la segmentación de años, seleccione 2020 y, en la segmentación Nombre del mes, seleccione Agosto. Escribir estas medidas

Medida 1 - suma (datos[ventas])

Medida 2 - calcular([medida 1],datesytd(calendar[date],"31/12"))

Medida 3 - calcular([medida 2],sameperiodlastyear(calendar[date]))

Espero que esto ayude.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@othmanbelmouzo , úse esto a cambio, si la tabla de fechas no está en contexto

return
 CALCULATE(Sales[Sales],DATESYTD(DATEADD('Date'[Date],-1,YEAR)),'Date'[Date]<=_max)
amitchandak
Super User
Super User

@othmanbelmouzo , Es posible que haya sidorcedo para hoy, fecha máxima o fecha seleccionada,

YTD QTY forzado
var _max hoy()
devolución
if(max('Date'[Date])<-_max, calculate('sum('order'[Qty]),DATESYTD('Date'[Date])), blank())
O
calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),filter('Date','Date'[Date]<'_max))
calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<'_max))

LYTD QTY forzado
var _max á date(year(today())-1,month(today()),day(today()))
devolución
if(max('Date'[Date])<'_max, CALCULATE('Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<-_max), blank())
O
CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<-_max)

YTD QTY forzado
var _max á maxx('orden',[Fecha de pedido])
devolución
if(max('Date'[Date])<-_max, calculate('sum('order'[Qty]),DATESYTD('Date'[Date])), blank())
calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),filter('Date','Date'[Date]<'_max))
calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<'_max))

LYTD QTY forzado
var _max1 á maxx('orden',[Fecha de pedido])
var _max á date(year(_max1)-1,month(_max1),day(_max1))
devolución
CALCULATE(Sum('order'[Qty]),DATESYTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<-_max)
TOTALYTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<-_max)

en lugar de hoy o maxx('orden',[Fecha de pedido])

puede tomar la fecha seleccionada maxx(allselected('Date'), 'Date'[Date])

Anonymous
Not applicable

No @amitchandak,

Me muestra en blanco. He hecho algo mal ?Capture d’écran 2020-12-29 162203.jpg

No @othmanbelmouzo ,

También puede consultar este blog:

https://www.kasperonbi.com/get-the-ytd-of-the-same-period-last-year/

Feliz Año Nuevo.

Saludos
Liang
Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Greg_Deckler
Super User
Super User

@othmanbelmouzo - Así que sí, puede usar cosas como PARALLELPERIOD o DATEADD. Puede encontrar esto útil - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

También, ver si mi Inteligencia del Tiempo el Camino Duro proporciona una manera diferente de lograr lo que está 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...

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.