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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
abeirne
Helper II
Helper II

Comparing year over year differences using datesbetween

Hi all, I am using two measures that calculate revenue as of today. I have one for the current year and one for the prior year. These measures allow me to compare the reservation amounts as of today vs today last year. Pic1.PNG

I am trying to find the year over year difference between the two, but I can't just subract them since the numbers are attached to the unique dates. Could anyone help with this? Thank you so much. Here are my measures:

YTD Current Year =
CALCULATE(
    MeasureTableQ[Reservation Charges SUM],
    DATESBETWEEN(
        'Rent-Roll-Report-2021-01-01-2023-12-31'[Origination Date],
        DATE(YEAR(TODAY()), "1", "1"),
        TODAY()
        )
)

YTD Prior Year =
CALCULATE(
    MeasureTableQ[Reservation Charges SUM],
    DATESBETWEEN(
        'Rent-Roll-Report-2021-01-01-2023-12-31'[Origination Date],
        DATE(YEAR(TODAY())-1, "1", "1"),
        DATE(
            YEAR(TODAY())-1,
            MONTH(TODAY()),
            DAY(TODAY())
        )
    )
)
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@abeirne , best in such case to use date table

 

YTD Today =
var _min = eomonth(today(),-1*month(today()))+1
var _max = today()
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

 

LYTD Today =
var _today = TODAY()
var _max = date(year(_today)-1, month(_today), day(_today))
var _min = eomonth(_max,-1*month(_max))+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

refer: https://medium.com/chandakamit/cheat-sheet-power-bi-time-intelligence-formulas-using-today-654f26e27...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
abeirne
Helper II
Helper II

Thank you! Also what i did was just make both of my measures into variables and returned both of them so that they are in one measure, then I was able to compare. Thanks!

amitchandak
Super User
Super User

@abeirne , best in such case to use date table

 

YTD Today =
var _min = eomonth(today(),-1*month(today()))+1
var _max = today()
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

 

LYTD Today =
var _today = TODAY()
var _max = date(year(_today)-1, month(_today), day(_today))
var _min = eomonth(_max,-1*month(_max))+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

refer: https://medium.com/chandakamit/cheat-sheet-power-bi-time-intelligence-formulas-using-today-654f26e27...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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