10 Replies Latest reply on Sep 22, 2016 7:51 AM by siyang.teo

# Splitting Time Slider into two (00:00 to 11.59) & (12.00 to 23.59).

Hi, I currently have a time slider like this below.

I will like to split it into two separate time sliders, one limiting from 00:00 to 11.59 (basically AM) and (12:00 to 23.59) PM.

Can anyone enlighten me? Thanks.

Attached sample twbx.

• ###### 1. Re: Splitting Time Slider into two (00:00 to 11.59) & (12.00 to 23.59).

May we know the reason for the same.. So that we could think of alternative approaches..

• ###### 2. Re: Splitting Time Slider into two (00:00 to 11.59) & (12.00 to 23.59).

Create two calculated fields as follows:

Morning

IF DATEPART('hour',[YF : Time]) < 12 THEN [YF : Time]

ELSE

#1900-01-01 12:00:00#

END

Evening

IF DATEPART('hour',[YF : Time]) >= 12 THEN [YF : Time]

ELSE

#1900-01-01 12:00:00#

END

Remove the original date [YF: Time] filter from the filters shelf and add Morning and Evening in its place.

1 of 1 people found this helpful
• ###### 3. Re: Splitting Time Slider into two (00:00 to 11.59) & (12.00 to 23.59).

****, I should have known this.

Thanks for much for the help!

• ###### 4. Re: Splitting Time Slider into two (00:00 to 11.59) & (12.00 to 23.59).

Hi Mary,

It appears that after splitting the slider, only one slider can function at one time to manipulate the graph.

They are not mutually inclusive once there is a break in time (at the 12:00 mark) between them.

Would you know how to make them inclusive?

Thanks!

• ###### 5. Re: Splitting Time Slider into two (00:00 to 11.59) & (12.00 to 23.59).

I like your idea of using DATETIME constants!

This even makes the in between calculation [YF : Time] unneeded!

The example below uses therefore the original date [Date Time]:

```IF DATEPART('hour',[Date Time]) < 12 THEN  #1900-01-01 00:00:00#
ELSE                                       #1900-01-01 12:00:00#
END
```
• ###### 6. Re: Splitting Time Slider into two (00:00 to 11.59) & (12.00 to 23.59).

Modify the sliders to return Null instead of Noon as follows:

Morning

IF DATEPART('hour',[YF : Time]) < 12 THEN [YF : Time]

END

Evening

IF DATEPART('hour',[YF : Time]) >= 12 THEN [YF : Time]

END

Then, ensure that the "Include Null Values" box is checked in the bottom left corner of both Edit Filter dialogs (right click on the field in the filter shelf and select Edit Filter to get to dialog)

• ###### 7. Re: Splitting Time Slider into two (00:00 to 11.59) & (12.00 to 23.59).

Thanks Mary, appreciate it lots. I should mark your answer as correct since you have answered it.

However, can I trouble you with one more answer?

What if I need the original 24 H slider to work too? I.e., Being able to have 3 time periods being filtered in the graph. One during AM, one during PM, and one choosing an empty range in between.

Really appreciate the help.

• ###### 8. Re: Splitting Time Slider into two (00:00 to 11.59) & (12.00 to 23.59).

If the original slider is added to the view as well, then all three filters will function simultaneously. This will allow the original slider to choose an overall date window and the other two sliders to choose windows within the am and pm.

Depending on what you are trying to achieve, another option would be to create date parameters to control the window, and use a calculation similar to:

IF [YF : Time] < [Parameter 1] OR [YF : Time] > [Parameter 2] THEN [YF : Time] ELSE NULL END

and filter out nulls.

• ###### 9. Re: Splitting Time Slider into two (00:00 to 11.59) & (12.00 to 23.59).

Apologies Mary,

I still have difficulties understanding and obtaining what I need.

If its not too much of a trouble, would you be able to provide a solution workbook using my sample? That will greatly facilitate my understanding.

Let's say I only want to show only data from 12AM-6AM, 6PM-12PM, and 8AM-4PM.

How should I go about it?

Thank you.

• ###### 10. Re: Splitting Time Slider into two (00:00 to 11.59) & (12.00 to 23.59).

Ok, I finally get what u meant now, thank you