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
BMaurus
Frequent Visitor

Rolling últimos 13 meses / YTD de conjunto de datos

Hola a todos

Tengo una pregunta rápida sobre el cálculo de dos medidas específicas que necesitaría para automatizar/simplificar los informes financieros en mi empresa:

- los últimos 13 meses

- YTD.

Mi conjunto de datos tiene este aspecto, donde tengo una columna "Monat" con un valor de fin de mes ("Wert") para cada mes:

Database.PNG

¿Cómo puedo crear ahora las dos medidas que se adaptan automáticamente después de los refrescos del conjunto de datos?

Muchas gracias de antemano!

BR, Benedict

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hola @BMaurus

Tratar

last 13 month = 
CALCULATE(SUM(Table[Wert]), Table[Monat] >= DATEADD(Table[Monat], -13, MONTH), ALL(Table) )

Y

YTD = 
TOTALYTD(SUM(Table[Wert]), Table[Monat], ALL(Table) )

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

2 REPLIES 2
az38
Community Champion
Community Champion

Hola @BMaurus

Tratar

last 13 month = 
CALCULATE(SUM(Table[Wert]), Table[Monat] >= DATEADD(Table[Monat], -13, MONTH), ALL(Table) )

Y

YTD = 
TOTALYTD(SUM(Table[Wert]), Table[Monat], ALL(Table) )

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
amitchandak
Super User
Super User

@BMaurus , puede utilizar las siguientes con inteligencia de tiempo

Rolling 13 - CALCULATE(sum(Sales[Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-13,MONTH))

Ultimas 13 periodos Mes ?
Var _max á maxx(allselected('Fecha','Fecha'[Fecha])
Var _min á date( year(_max),month(_max)-13,day(_max))
devolución
CALCULATE(SUM(Sales[Net Sales]),FILTER(all('Date'),'Date'[Date]>'_min && 'Date'[Date]<-_max))

Consulte también: https://www.youtube.com/watch?v=duMSovyosXE

YTD de varias maneras

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]))


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)


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)

//only work with 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))

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.