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
Rubal_Islam
Helper II
Helper II

Sales YTD and Last Year YTD

Hi All,

 

Need some help with Sales YTD and Sales for Last Year YTD.

I have two measures as per below to calculate Sales YTD and Last Year'S Sales YTD

 

I have a Calendar table and my financial year starts in July. both tables are connected via date.

Calendar = CALENDARAUTO(6)

 

The data source table has Date, Location, and Sales Column.

 

YTD Sales = CALCULATE(sum(Sales[Sales]),DATESYTD(ENDOFYEAR('Calendar'[Date]),"06/30"))
 
LY YTD = CALCULATE(SUM(Sales[Sales]),DATESYTD(dateadd('Calendar'[Date],-1, YEAR),"6/30"))
 
However,  "LY YTD" is showing an accumulative total for the last financial year, rather than for July 21, only.
 
"YTD Sales" is showing the correct data.
 
  Rubal_Islam_1-1660281763190.png                       Rubal_Islam_2-1660281772104.png   Rubal_Islam_3-1660281946161.png

 

 

Appreciate your help on this.

 

Regards

RI

 


 

4 REPLIES 4
HoangHugo
Solution Specialist
Solution Specialist

Hi
I tried to revise something

YTD Sales = CALCULATE(sum(Sales[Sales]),DATESYTD('Calendar'[Date],"06/30"))

 

About your LY YTD, as I know ,function DATEADD will return to a whole last month, mean dateadd('Calendar'[Date],-1, YEAR),"6/30") will be 1/7/2021-31/7/2021

to your expect, i tried revise:

 

LY YTD = CALCULATE(SUM(Sales[Sales]),DATESYTD('Calendar'[Date],"6/30"), 'Calendar'[Date] <= DATEADD (ENDOFYEAR ('Calendar'[Date],"6/30"),-1,YEAR))

Tsrivastava
Frequent Visitor

Try Using 
Ytd = totalytd(sum(sales), datetable)
last year ytd = calculate(ytd, dateadd(datetable ,-1 , year)

hi @Tsrivastava , unfortunately, it doesn't work. the table returns blank.

 

YTD Sales 2 = TOTALYTD(sum(Sales[Sales]),'Calendar'[Date])
 
Rubal_Islam_0-1660286072618.png

 

 

@Rubal_Islam , The measure is correct, but there is no date in context. datesytd take the last date of the calendar, for which you might not have data.

 

Other than that, make sure, the calendar table is marked as date table.

 

There 6 such rules refer

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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