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