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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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