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

Diferencias y usos para TOTALYTD y SAMEPERIODLASTYEAR

Hola, 

 

Me gustaría saber las diferencias entre las funciones TOTALYTD y SAMEPERIODLASTYEAR.

¿TOTALYTD comienza en enero y acaba en el mes que se selecciona?

 

¿En qué oacasiones usan cada una de las fuinciones?

 

En mi caso hago necesito hacer un informe financiero y calcular el "Year today" de varios años. Por ejemplo necesito volúmenes desde enero a junio de este 2022 y de los años 2021, 2020 y 2019... ¿qué función es la más recomendable apra este caso?

 

Gracias!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Josevi , Totalytd, sum up data till date from the start of the year (Date in the rows or context)

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

SAMEPERIODLASTYEAR

give data  1 year behind. Period will be decided by row or the filter context

 

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

 

almost same as

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Josevi , Totalytd, sum up data till date from the start of the year (Date in the rows or context)

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

SAMEPERIODLASTYEAR

give data  1 year behind. Period will be decided by row or the filter context

 

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

 

almost same as

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

amitchandak
Super User
Super User

@Josevi , Totalytd, sum up data till date from the start of the year (Date in the rows or context)

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

SAMEPERIODLASTYEAR

give data  1 year behind. Period will be decided by row or the filter context

 

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),SAMEPERIODLASTYEAR('Date'[Date]))

 

almost same as

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

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.