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
droupa
Frequent Visitor

Date Filter within Measure

Hi,

 

I want to add 2 filters onto a measure.

I have a table with reservations records that have date fields for "Arrival date" and "Booking date"

 

This table is linked to a calendar table via an active relationship between "Date" and "Arrival date"

 

I want to compare current period revenue with prior period revenue, but exclude reservations in my prior year comparative that have a booking date within 1 year of the last current booking date (in other words, to compare with where we are now, with where we were at the same date this time last year)

 

I wanted to use the following measure, but it shows as bank on my visualization:

 

PY YTD Total Revenue = calculate(
[Total Revenue],SAMEPERIODLASTYEAR('Calendar'[Date]),
filter(Reservations,Reservations[Booking Date]<=dateadd(LASTDATE(Reservations[Booking Date]),-1,year))
)

 

 

The measure [Total Revenue] within this formula is:

Total Revenue = sumx(filter(Reservations,Reservations[Notes2]="Reserved"),Reservations[Revenue ex VAT])
 
 
Below is a link to my .pbix file.
 
Does anyone know what I am doing incorrectly?
The tab I am working on is "Cumulative Sales Report - Actual vs Prior year
 
Thanks!
 
 

 

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @droupa 

I make a simple test, is my understanding correct?

11.png

 

Best Regards
Maggie

Hi Maggie,

 

What format is your date in? MM/DD/YYYY?

 

Basically, if the last booking date in my data is 10 April 2018, then bookings with a booking date greater than 10 April 2017 should be excluded from the comparitive figure.

 

The logic is that at the same point in time one year ago, those bookings had not yet been made, so I want to have a fair comparison.

 

Thanks!

 

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.