# Dataset Min/Max Date Expression

**URL:** <https://forum.inductiveautomation.com/t/dataset-min-max-date-expression/112656>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [December 5, 2025, 5:47pm UTC](https://forum.inductiveautomation.com/t/dataset-min-max-date-expression/112656 "2025-12-05T17:47:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [December 5, 2025, 5:47pm UTC](https://forum.inductiveautomation.com/t/dataset-min-max-date-expression/112656/1 "2025-12-05T17:47:39Z")

</div>

I have a dataset on a sparkline populated by a tag history binding. I’ve used min() and max() expressions to get the min and max value. I’d like to do the same to get the start and end date from the dataset, but the same expression isn’t quite working on the t\_stamp column.

For instance, max (works):

```python
max({Root Container.Sparkline Chart.data},1)

```

End date (doesn’t work):

```python
max({Root Container.Sparkline Chart.data},0)

```

How can I get the start and end date from the sparkline dataset?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 5, 2025, 5:58pm UTC](https://forum.inductiveautomation.com/t/dataset-min-max-date-expression/112656/2 "2025-12-05T17:58:28Z")

</div>

You cannot get it from the dataset, as history results don't guarantee that result timestamps fall exactly on the start and end boundary. For any aggregate, the last timestamp will be one interval short of the boundary.

You have to be feeding the history binding a date range, so you should simply use that.

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [December 5, 2025, 5:59pm UTC](https://forum.inductiveautomation.com/t/dataset-min-max-date-expression/112656/3 "2025-12-05T17:59:52Z")

</div>

Using realtime, last 8 hours.

It’s just any other dataset at this point with a `t_stamp` and a `value` column. There should be a way to get a numeric representation of the `t_stamp` value and find the min/max, right?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 5, 2025, 6:02pm UTC](https://forum.inductiveautomation.com/t/dataset-min-max-date-expression/112656/4 "2025-12-05T18:02:07Z")

</div>

Maybe like this for generic use, but your dataset would already be sorted right?

```javascript
// sort by date descending, then grab first row value
sortDataset({Root Container.Sparkline Chart.data},0,False)[0][0]

```

---

<div class="post-metadata">

**Author:** ![amarks](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amarks/32/45610_2.png) [@amarks](https://forum.inductiveautomation.com/u/amarks)\
**Post date:** [December 5, 2025, 6:09pm UTC](https://forum.inductiveautomation.com/t/dataset-min-max-date-expression/112656/5 "2025-12-05T18:09:02Z")

</div>

It’s a tag history binding, I believe they are sorted oldest is [0] and newest is [len()-1] so, I guess there’s my answer. Officially:

```python
{dataset}[0,'t_stamp']

```

and

```python
{dataset}[len({dataset})-1,'t_stamp']

```

Of course, if it’s any old dataset it would have to be sorted first, tag history already is
