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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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...

Share with Power BI Enthusiasts: 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...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.