# How to create 15min interval using datetime & value fields in Quicksight

**URL:** <https://community.amazonquick.com/t/how-to-create-15min-interval-using-datetime-value-fields-in-quicksight/11874>\
**Category:** Q&A\
**Tags:** quick-sight\
**Created:** [April 5, 2023, 5:33am UTC](https://community.amazonquick.com/t/how-to-create-15min-interval-using-datetime-value-fields-in-quicksight/11874 "2023-04-05T05:33:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![faisalchohan](https://avatars.discourse-cdn.com/v4/letter/f/7c8e57/32.png) [@faisalchohan](https://community.amazonquick.com/u/faisalchohan)\
**Post date:** [April 5, 2023, 5:33am UTC](https://community.amazonquick.com/t/how-to-create-15min-interval-using-datetime-value-fields-in-quicksight/11874/1 "2023-04-05T05:33:00Z")

</div>

Hi QS community,

I am struggling to create 15min interval using datetime & value fields.  
Basically I am trying to calculate/display number of people count at that given time within the 15min interval based on the value.  
Calculated field: datetime (15min Interval) - addDateTime((extract(‘MI’, datetime) % 15), ‘HH’, datetime)

getting below result

|datetime (15min Interval)|value|  
|2023-02-28 11:00:10|268|  
|2023-02-28 12:00:04|289|  
|2023-02-28 13:00:02|304|  
|2023-02-28 14:00:01|319|  
|2023-02-28 15:00:00|328|  
|2023-02-28 16:00:00|333|  
|2023-02-28 18:00:01|339|  
|2023-02-28 19:13:53|340|  
|2023-02-28 20:13:55|680|  
|2023-02-28 22:13:52|344|  
|2023-02-28 23:13:54|690|

Something like this I am trying to achieve.

 ![Screen Shot 2023-04-05 at 3.26.51 pm](https://d1wl4jav5dp96l.cloudfront.net/original/2X/d/d9bfee4d61401d434778165ff27ee72e35e37416.png)

Your help will be appreciated

---

<div class="post-metadata">

**Author:** ![Max](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/max/32/2288_2.png) [@Max](https://community.amazonquick.com/u/Max)\
**Post date:** [April 5, 2023, 6:12pm UTC](https://community.amazonquick.com/t/how-to-create-15min-interval-using-datetime-value-fields-in-quicksight/11874/2 "2023-04-05T18:12:07Z")

</div>

> [@faisalchohan](#):
>
> addDateTime((extract(‘MI’, datetime) % 15), ‘HH’, datetime)

Shouldn’t this be `addDateTime((extract(‘MI’, datetime) % 15), 'MI', datetime)`

---

<div class="post-metadata">

**Author:** ![faisalchohan](https://avatars.discourse-cdn.com/v4/letter/f/7c8e57/32.png) [@faisalchohan](https://community.amazonquick.com/u/faisalchohan)\
**Post date:** [April 6, 2023, 3:17am UTC](https://community.amazonquick.com/t/how-to-create-15min-interval-using-datetime-value-fields-in-quicksight/11874/3 "2023-04-06T03:17:31Z")

</div>

> [@Max](#):
>
> addDateTime((extract(‘MI’, datetime) % 15), ‘MI’, datetime)

Literally, I have tried with ‘MI’ yesterday, I was testing something else and pasted the wrong formula with ‘HH’.

find the result below, it is still not working

 ![1](https://d1wl4jav5dp96l.cloudfront.net/original/2X/1/1fc38ef96928540352754c6dd2fee5398b779b00.png)

---

<div class="post-metadata">

**Author:** ![faisalchohan](https://avatars.discourse-cdn.com/v4/letter/f/7c8e57/32.png) [@faisalchohan](https://community.amazonquick.com/u/faisalchohan)\
**Post date:** [April 6, 2023, 3:18am UTC](https://community.amazonquick.com/t/how-to-create-15min-interval-using-datetime-value-fields-in-quicksight/11874/4 "2023-04-06T03:18:03Z")

</div>

![2](https://d1wl4jav5dp96l.cloudfront.net/original/2X/d/d0c77bfc724e814d6ac7d14b3cfd805fbcd128e6.png)

---

<div class="post-metadata">

**Author:** ![faisalchohan](https://avatars.discourse-cdn.com/v4/letter/f/7c8e57/32.png) [@faisalchohan](https://community.amazonquick.com/u/faisalchohan)\
**Post date:** [April 6, 2023, 3:20am UTC](https://community.amazonquick.com/t/how-to-create-15min-interval-using-datetime-value-fields-in-quicksight/11874/5 "2023-04-06T03:20:24Z")

</div>

![3](https://d1wl4jav5dp96l.cloudfront.net/original/2X/4/421181fa65d515cbda37a5211708bb7fee9829fc.png)

---

<div class="post-metadata">

**Author:** ![Max](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/max/32/2288_2.png) [@Max](https://community.amazonquick.com/u/Max)\
**Post date:** [April 6, 2023, 3:23pm UTC](https://community.amazonquick.com/t/how-to-create-15min-interval-using-datetime-value-fields-in-quicksight/11874/6 "2023-04-06T15:23:53Z")

</div>

Ah you need to subtract the remainder. Not add it.

```auto
addDateTime(-(extract('MI',{arrival_timestamp})%15),'MI',{arrival_timestamp})

```

---

<div class="post-metadata">

**Author:** ![Rodger](https://d2orw1595917va.cloudfront.net/user_avatar/community.amazonquick.com/rodger/32/21433_2.png) [@Rodger](https://community.amazonquick.com/u/Rodger)\
**Post date:** [June 12, 2024, 9:27am UTC](https://community.amazonquick.com/t/how-to-create-15min-interval-using-datetime-value-fields-in-quicksight/11874/7 "2024-06-12T09:27:56Z")

</div>

Hi folks. I was able to get @Max solution to work in Analysis - thanks. I am wondering about in Dataset preparation - it fails there.

I have two separate datasets that i would like to Join via Data Time. Each dataset reports within a 15 minute window but is off by a minute or two of each other. With no coherence in the minute the Join response is bad.

I had hoped to create a calculated field for each dataset that rounds the time to the 15 minute block, following @faisalchohan, however I get the error (see red text image below) - using many variations of the snippet below.

Any way of tweaking this to use in Dataset editing and calculated field creation to Join datasets?

> addDateTime(-(extract(‘MI’,{DateTime})%15),‘MI’,{DateTime})

 ![image](https://d1wl4jav5dp96l.cloudfront.net/original/3X/d/1/d12f7f1ddb334ccd2a7072fcd1d1d77ad86d6fbb.png)

|Dateset 1||

|DateTime|Value|  
|2024/06/01T12:01|20|  
|2024/06/01T12:17|80|  
|2024/06/01T12:35|30|  
|2024/06/01T12:48|11|  
|2024/06/01T13:02|65|  
|2024/06/01T13:18|89|  
|2024/06/01T13:36|41|  
|2024/06/01T13:49|30|  
|2024/06/01T14:03|22|  
|2024/06/01T14:19|55|  
|2024/06/01T14:37|68|  
|2024/06/01T14:50|11|

|Dateset 2||  
|DateTime|Value|  
|2024/06/01T12:06|22|  
|2024/06/01T12:15|55|  
|2024/06/01T12:37|68|  
|2024/06/01T12:50|11|  
|2024/06/01T13:04|65|  
|2024/06/01T13:16|89|  
|2024/06/01T13:33|41|  
|2024/06/01T13:46|30|  
|2024/06/01T14:08|65|  
|2024/06/01T14:16|89|  
|2024/06/01T14:31|41|  
|2024/06/01T14:46|30|
