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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Suryaann111
Frequent Visitor

Diff of two date fields for same period last year based on selection in date slicer

Hi All,
Need help.
I have a date hierarchy slicer in which I can select day,year,month.
I have a calendar table which has the below structure
Calendar date date_id year month day
2018-01-01. 2018-01-01 2018 1 1

.....
2020-01-01 ....

Booking table
Rooms. Booking-start Booking_end transdte
1A. 2018-04-04. 2018-04-08 2018-04-03
1C. 2018-09-08. 2018-09-23
2018-04-23
1b. 2019-05-07. 2019-05-08
2019-05-01
2s. 2019-06-06. 2019-06-07
2019-05-05
1A 2019-03-09. 2019-03-11
2019-04-03
1C 2019-08-09. 2019-09-01
2019-04-05
This calendar date is mapped with transaction date.
When the day selected in the slicer is 2019-04-03,then the measure should calculate the diff of booking start and end dates for 2018-04-03,ie 4.
If the selection is 2019-04,then the below data is retrieved,
1A. 4
1C. 15

Someone help please
2 REPLIES 2
Suryaann111
Frequent Visitor

Thanks.
This will give the selected years data.iam looking for last year measure.
amitchandak
Super User
Super User

datediff(booking[booking Start],booking[booking end],day)

It will give you date difference. You are already filtering using date dimension joined the transaction date. So it should filter data.

 

Did not get the real issue.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.

Top Solution Authors
Top Kudoed Authors