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

Get start and end date from date slicer

I am trying to calculate the total working time for a person.

 

Event: End Shift - Date: 05/08/2019 - Total working time: 4 days

Event: Start Shift - Date:  01/08/2019

 

If my date slicer is set to be in the range 03/08/2019 to 05/08/2019, I will only see the End Shift Event.

 

In this case, I want to calcuate the working time from the START of the report period (which is 03/08/2019) to the End Shift event.

So it should show 2 days instead of 4 days.

 

 

6 REPLIES 6
Anonymous
Not applicable

Hi,

Create a measure as below and drag your date field in the slicer:

Working Days = DATEDIFF( 
                CALCULATE ( MIN(Dates[Date]), ALLSELECTED(Dates) ), 
                CALCULATE ( MAX(Dates[Date]), ALLSELECTED(Dates) ), DAY 
                )

result.PNG

Thanks.

@Anonymous Hi, it doesn't work for me. If there is no data on day 24-08-2015, then the Min date will be the first date with available data.

Anonymous
Not applicable

Hi,
Can you share some sample data with this scenario and the expected result.
Thanks.

@Anonymous 

exampleexample

 

So this person is available since 08/22/2019 till 08/25/2019 in the morning when he logged a break.

My date slicer is from 08/23/2019 to 08/25/2019, and i want the working time to be include all the time since start of date slicer till he logged the break.

But since there is no event on day 23 or day 24, the min date was returned as day 25.

Hi @marcus_ushare ,

 

Does the localdate slicer from another table? please show us your dummy pbix/simple  worksheet.  we can barely make sure your data structure.

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

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.