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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
theaskk_1
Helper I
Helper I

Need help to get last 10 FYs data to YTD

Hello Team,

         I have requirement like below.

1.Having FY calender table having columns like Date, FY year, FY month, FY quarter, FY Week number. 

   Note:- FY starts from Jul 1st to Jun 30th every year.

2. Sales table . based on one column i mapped from FY table to this table.

3.currently i should show last 10 FY data in matrics.  i mean today is suppose Jan-03-2022 so i should show all years data to till same day  respect to year. for FY19 data should be till Jan-03-2020, FY20 be like Jan-03-2021.

 

Any ways please let me know

1 REPLY 1
amitchandak
Super User
Super User

@theaskk_1 , Try like

Make sure you have the day of the year as column in the date table

 

day of year = datediff( if(month([Date]) <7, Date(year(_max)-1,7,1) , Date(year([Date]),7,1)) , [Date] ,day)+1

 

YTD Corrected =
var _max =allselected('Date'),'Date'[Date])

Var _day = datediff( if(month(_max) <7, Date(year(_max)-1,7,1) , Date(year(_max),7,1)) , _max ,day) +1
return
calculate(Sum('order'[Qty]),DATESYTD('Date'[Date], "6/30"),'Date'[Day of year ]<=_day)

 

 

or

 

YTD= CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year]) && 'Date'[Day of Year] <= Max('Date'[Day of Year]) ))

 

LYTD = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year]=max('Date'[Year])-1 && 'Date'[Day of Year] <= Max('Date'[Day of Year])))

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.