# Find when a Number Field value crossed a threshold via History API (script)

**URL:** <https://community.fibery.io/t/find-when-a-number-field-value-crossed-a-threshold-via-history-api-script/10618>\
**Category:** Fibery Showcase\
**Tags:** history, api\
**Created:** [March 23, 2026, 7:50am UTC](https://community.fibery.io/t/find-when-a-number-field-value-crossed-a-threshold-via-history-api-script/10618 "2026-03-23T07:50:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![antoniokov](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/antoniokov/32/201_2.png) [@antoniokov](https://community.fibery.io/u/antoniokov)\
**Post date:** [March 23, 2026, 7:50am UTC](https://community.fibery.io/t/find-when-a-number-field-value-crossed-a-threshold-via-history-api-script/10618/1 "2026-03-23T07:50:30Z")

</div>

With the recent [introduction](https://community.fibery.io/t/march-12-2026-better-file-support-in-table-view-block-reordering-in-text-editor-via-keyboard-shortcuts-history-api/10537) of [History API](https://the.fibery.io/@public/User_Guide/Guide/History-API-470), we were able to solve a problem deemed too messy to solve before. I thought we might as well share the solution in case anyone faces a similar challenge.

### Problem to solve

For each entity in a Database, understand when the value of a certain Number Field crossed a threshold.

For example, for each Event, understand when the number of registrations crossed the 100 people mark — the point when an Event typically breaks even and is worth organizing.

### Story behind it

Over the last three years, the conversion from sign-up to purchase has increased ~8x here at Fibery. Which is freaking fantastic but also somewhat misleading. Some purchases are, in fact, extended trials — with the newly acquired “customer” cancelling soon after the purchase.

So, not to look gleefully at the wrong metric, we decided to measure the conversion from sign-up to **second** paid seat. This would also leave out solo purchases which are outside of our B2B focus.

### Road to solution

For every workspace, we need to understand if they 2-seats-converted within 28 days from the sign-up. We already have the sign-up date (obviously), so all we need is the second-seat-purchased date and a formula to subtract the two.

For new purchases, we set up an automation Rule:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/f/faa3153450c34f597591deaa8c4c0a4d573a0a89.png)

But what about the historical data? We’d need some baseline!

### Solution (History API script)

Before ~~vibe coding~~ agentic engineering and History API, we’d probably have to torture [Historical Reports](https://the.fibery.io/@public/User_Guide/Guide/Current-vs-Historical-data-in-Reports-168), export them to CSV, create a pivot table in Excel, and hope for the best.

Now, with a little help from Claude Code, we’ve created (and tested) a few scripts:

1. Find threshold crossings (e.g., when Subscription.Users became ≥ 2).
2. Enrich them (in our case, the Number Field was on Subscriptions DB but the Date Field should be on Workspaces DB, so we had to map IDs).
3. Set the dates (→ Workspace.[Second Purchase Date]).

Here are the scripts in our `fibery-community` repository together with some instructions on how to run them:

> **[find-threshold-crossings-via-history · master · fibery-community /...](https://gitlab.com/fibery-community/api-examples/-/tree/master/find-threshold-crossings-via-history)**
>
> GitLab.com

Feel free to use this suite as is, fork it, or simply provide to your coding agent as an example when working with History API.

If you have any questions, please let me know!

P.S. It turned out, our conversion is still pretty good, even when measured meaningfully 🥲. That being bragged, what we’d love to see is more nerds who run orgs that know about Fibery. If you know one, please tell them about the product!
