cancel
Showing results for
Did you mean:
Highlighted
Member

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

Accepted Solutions
Moderator

## Re: Duration/Time

@bhmiller89

Check whether below formula can achieve your goal or not.

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"
)
2 REPLIES 2
Frequent Visitor

## Re: Duration/Time

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

Moderator

## Re: Duration/Time

@bhmiller89

Check whether below formula can achieve your goal or not.

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"
)

Announcements

#### Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

#### Community News & Announcements

Get your latest community news and announcements.

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Top Kudoed Authors
Users Online
Currently online: 115 members 1,460 guests
Recent signins: