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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
stampgeorge
Frequent Visitor

Compare this year vs last year based on two dates

Hello, 

I'm creating a reservation report for a hotel.

I need to calculate the room nights, revenue etc, and compare this year to last year.

The problem is with last year. I need to only sum the data I need based on booking date and the arrival date.

For example, I want to compare 2025 with 2024 at 30/6/25. 2025 is current data so it's ok.

For 2024, I need all the bookings made from 1/1/23 until 29/6/24, that concern arrivals for last year 1/1/24 - 31/12/24.

I've tried many filters and dax expressions but it doesn't work.

The goal is to use them with the new cards as reference.

Thanks!

1 ACCEPTED SOLUTION
v-nmadadi-msft
Community Support
Community Support

Hi @stampgeorge ,


Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information. Do not include anything that is unrelated to the issue or question.

Please show the expected outcome based on the sample data you provided.
Thank you

View solution in original post

11 REPLIES 11
v-nmadadi-msft
Community Support
Community Support

Hi @stampgeorge ,

As we haven’t heard back from you, we wanted to kindly follow up to check if its possible to provide sample data, so that we can investigate it. 

 

Thanks and regards

v-nmadadi-msft
Community Support
Community Support

Hi @stampgeorge 

As we haven’t heard back from you, we wanted to kindly follow up to check the status of your issue, if it is still unresolved, Kindly share some sample data so that we can take a closer look and try to assist you further?

Thanks and regards

v-nmadadi-msft
Community Support
Community Support

Hi @stampgeorge 

May I check if this issue has been resolved? If not, could you please share some sample data so we can investigate further and provide more targeted assistance?

Thank you.

v-nmadadi-msft
Community Support
Community Support

Hi @stampgeorge ,


Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information. Do not include anything that is unrelated to the issue or question.

Please show the expected outcome based on the sample data you provided.
Thank you

miTutorials
Super User
Super User

If you need to compare using 2 different slicers here is a video - let me know if this helps!

 

Compare any week/Year using 2 Slicers as input in PowerBI | MiTutorials

DataVitalizer
Super User
Super User

Hi @stampgeorge 


Are you willing to hardcode the date to achieve your goal, so I can adapt my suggestion accordingly?

Did it work 👍 A kudos would be appreciated ‌‌📢 Mark it as a solution to help spreading knowledge

I'd prefer not to, so I could use a year slicer that updates the data dynamically.

MasonMA
Super User
Super User

@stampgeorge 

Hi, could you provide us with those DAX expressions you tried that are not working ?

Room Nights3 = CALCULATE(SUM(Statistics[Rm Nights]), USERELATIONSHIP(DateTable[Date], Statistics[Business Date]), DATESBETWEEN(Statistics[Arrival Date], DATE(YEAR(TODAY()),1,1), DATE(TODAY(),12,31)), DATESBETWEEN(Statistics[Booked Date], DATE(YEAR(TODAY())-1,1,1), TODAY() - 1))

Maybe try modifying your filter context this way ?

FILTER(
        Statistics,
        Statistics[Arrival Date] >= DATE(YEAR(TODAY()), 1, 1)
            && Statistics[Arrival Date] <= DATE(YEAR(TODAY()), 12, 31)
    ),
FILTER(
        Statistics,
        Statistics[Booked Date] >= DATE(YEAR(TODAY()) - 1, 1, 1)
            && Statistics[Booked Date] <= TODAY() - 1
    )

 

It doesn't seem to work properly, the number it calculates is closer to the arrivals of the year (but not the correct number) than the room nights.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.