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

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.