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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.