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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
stampgeorge
Frequent Visitor

Calculating bookings based on booking date

Hello!

I want to create a line graph that shows the bookings made for the last year based on today and compare it with the bookings this year, per month.

Basically, I want two lines, one with this years bookings made until today (which is easy), and a second one showing last year booking nr. by month where the bookings were made this day last year.

 

I have this for now:

LY Resv = 
CALCULATE(
    COUNTROWS(Reservations),
    Reservations[Arrival] = DATESBETWEEN('Date'[Date],DATE(YEAR(TODAY())-1,1,1),DATE(YEAR(TODAY())-1,12,31)),
    Reservations[Booked_Date] <= DATE(YEAR(TODAY())-1,TODAY(),TODAY()))

But it doens't work because it requires a T/F statement instead of datesbetween.

 

Thank you!

1 REPLY 1
DataInsights
Super User
Super User

@stampgeorge,

 

DATESBETWEEN returns a table, so try using IN:

 

LY Resv =
CALCULATE (
    COUNTROWS ( Reservations ),
    Reservations[Arrival]
        IN DATESBETWEEN (
            'Date'[Date],
            DATE ( YEAR ( TODAY () ) - 1, 1, 1 ),
            DATE ( YEAR ( TODAY () ) - 1, 12, 31 )
        ),
    Reservations[Booked_Date]
        <= DATE ( YEAR ( TODAY () ) - 1, TODAY (), TODAY () )
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors