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

Cambio interanual en la matriz con el año del año en curso

Buenas noches

Tengo una matriz con años en las columnas. Quiero calcular el porcentaje de cambio interanual en esta matriz sólo para el período transcurrido en el año en curso (YTD 2020 frente al mismo período en 2019). Preferiblemente dinámico, de modo que cuando el informe se actualice el próximo año se compare 2021 con 2020 y así sucesivamente. El problema es que cuando escribo esta medida: la calcula para cada año en mi visualización y esto añade demasiadas columnas a mi visualización de matriz:

El año pasado
VAR BrutoGewichtVorigJaar ?
CALCULATE ( [Brutogewicht]; SAMEPERIODLASTYEAR ( Datumtabel[Fecha] ) )
devolución
( [Brutogewicht] - BrutoGewichtVorigJaar ) / [Brutogewicht]

¿Alguien sabe cómo sólo puedo mostrar este Cálculo YTD YoY para el año actual en la visualización?
Saludos
2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @PieterSt,

Por favor, comparta algunos datos ficticios con una estructura de datos similar a sus datos sin procesar y el resultado esperado para ayudarnos a aclarar su escenario y probar la fórmula de codificación en él.

Cómo obtener respuesta rápida a su pregunta

Además, también puede echar un vistazo al siguiente vínculo para utilizar la función de fecha para definir manualmente el rango de filtro para calcular.

Inteligencia del tiempo "The Hard Way" (TITHW)
saludos

Xiaoxin SHeng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@PieterSt , Pruebe la inteligencia de tiempo con una tabla de fechas

YTD QTY = TOTALYTD(Sum('order'[Qty]),'Date'[Date])
LYTD QTY = TOTALYTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year))
Previous Year = CALCULATE(SUM('order'[Qty]), PREVIOUSYEAR('Date'[Date]))

// forced based on Today
YTD QTY forced= 
var _max = today()
return
calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),'Date'[Date]<=_max)
//calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<=_max))

LYTD QTY forced= 
var _max = date(year(today())-1,month(today()),day(today()))
return
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)

//Forced based on last avaiable Date 
YTD QTY forced= 
var _max = maxx('order',[Order date])
return
calculate(Sum('order'[Qty]),DATESYTD('Date'[Date]),'Date'[Date]<=_max)
//calculate(TOTALYTD(Sum('order'[Qty]),'Date'[Date]),filter('Date','Date'[Date]<=_max))

LYTD QTY forced= 
var _max1 =maxx('order',[Order date])
var _max = date(year(_max1)-1,month(_max1),day(_max1))
return
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)

//This year vs last year

This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
//year behind measure
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

Para obtener lo mejor de la función de inteligencia de tiempo. Asegúrese de que tiene un calendario de fechas y se ha marcado como la fecha en la vista de modelo. Además, únase a él con la columna de fecha de su hecho/s. Consulte:
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Vea si mi seminario web sobre Time Intelligence puede ayudar: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Aprecia tus Felicitaciones.

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.