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
Saniat
Helper V
Helper V

Calculate YTD relative to the End Date from the Date slicer

Hi,

I have a Date Slicer for the report, and wantto display YTD measure.

When the End of Previous Year is within the Date Slicer selection, this is not a problem, but if for example the date slicer selects Feb 2022 to July 2022, then how do I get the data for Dec 2021 and July 2022 ?

Thanks.

1 ACCEPTED SOLUTION

@Saniat,

 

YTD = CALCULATE( <your expression>, DATESYTD(LASTDATE('Date'[Date])), ALL(Date))

 

View solution in original post

4 REPLIES 4
Saniat
Helper V
Helper V

Thank you. Had to modify a little bit to get ONLY THE FIRST MONTH, but you solved the key part of it. Thanks again.


FIRSTDATE
(
                 DATESYTD(
                                  LASTDATE('Dates'[Date ID])
                                  )
                 )
SivaMani
Resident Rockstar
Resident Rockstar

@Saniat ,

  1. Do you want YTD value based on the slicer's End date?
  2. For example, if you select Feb'22 to Jul'22,  do you need to calculate the value for Jan'22 to July'22?
  3. Do you have any date tables in your dataset?

1. yes
2. yes
3. yes - the slicer is based on that table

@Saniat,

 

YTD = CALCULATE( <your expression>, DATESYTD(LASTDATE('Date'[Date])), ALL(Date))

 

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.