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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
bhmiller89
Helper V
Helper V

Duration/Time

Is there any known way to filter using time stamps?

 

I'm trying to determine if a scheduled appointment is in the "AM slot," the "PM slot," or "All Day."

 

I have start and end dates and I calculated a duration (horus) column.  I tried to write 

 

slot = IF('SR Calendar'[RequestedStartDateConv] = 09:00:00AM & 'SR Calendar'[RequestedEndDateConv] = 01:00:00PM, "AM", IF('SR Calendar'[RequestedStartDateConv] = 02:00:00PM & 'SR Calendar'[RequestedEndDateConv] = 06:00:00PM, "PM", IF('SR Calendar'[AdjDuration] = 8, "All Day", "Other")))

 

Help? Is this even possible? 

1 ACCEPTED SOLUTION
Eric_Zhang
Employee
Employee

@bhmiller89

 

Check whether below formula can achieve your goal or not.

 

Capture.PNG

 

slot = 
SWITCH (
    TRUE (),
    HOUR ( 'SR Calendar'[RequestedStartDateConv] ) = 9
        && HOUR ( 'SR Calendar'[RequestedEndDateConv] ) = 13, "AM",
    HOUR ( 'SR Calendar'[RequestedStartDateConv] ) = 14
        && HOUR ( 'SR Calendar'[RequestedEndDateConv] ) = 18, "PM",
    "ALL DAY"
)

View solution in original post

2 REPLIES 2
Eric_Zhang
Employee
Employee

@bhmiller89

 

Check whether below formula can achieve your goal or not.

 

Capture.PNG

 

slot = 
SWITCH (
    TRUE (),
    HOUR ( 'SR Calendar'[RequestedStartDateConv] ) = 9
        && HOUR ( 'SR Calendar'[RequestedEndDateConv] ) = 13, "AM",
    HOUR ( 'SR Calendar'[RequestedStartDateConv] ) = 14
        && HOUR ( 'SR Calendar'[RequestedEndDateConv] ) = 18, "PM",
    "ALL DAY"
)
dpotta
Resolver I
Resolver I

Hi @bhmiller89

 

You could use a SWITCH function with TRUE in DAX for that column with >= 9:00 <13:00 etc values.

 

Here is a tutorial

 

http://www.powerpivotpro.com/2015/03/the-diabolical-genius-of-switch-true/

 

Dave

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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