Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.