# Custom interval fields

**URL:** <https://forum.intervals.icu/t/custom-interval-fields/25942>\
**Category:** Uncategorized\
**Created:** [27 December 2022 09:54 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942 "2022-12-27T09:54:04Z")\
**Posts on this page:** 20\
**Page:** 5

<div class="post-metadata">

**Author:** ![Firestop](https://forum.intervals.icu/user_avatar/forum.intervals.icu/firestop/32/25896_2.png) [@Firestop](https://forum.intervals.icu/u/Firestop)\
**Post date:** [5 December 2024 07:59 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/81 "2024-12-05T07:59:40Z")

</div>

Thank you! I’m not sure why I didn’t think of that….I appreciate your help…worked like a charm,

---

<div class="post-metadata">

**Author:** ![Zen\_Turtle](https://forum.intervals.icu/user_avatar/forum.intervals.icu/zen_turtle/32/26755_2.png) [@Zen\_Turtle](https://forum.intervals.icu/u/Zen_Turtle)\
**Post date:** [3 March 2025 01:20 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/82 "2025-03-03T01:20:56Z")

</div>

Can’t figure out a way to do this and did not show up in the search for public custom fields: The interval table shows an intensity column, that is the percentage of FTP power for a given interval.  
I would like to calculate and show the percentage of the MMP for the specific duration of the interval: for instance for the 4m intervals at 312W it should show 84% (given my 4m MMP from power duration curve being 368W)  
Is there a way to do that? (for activities in the past it should ideally use MMP at the time of the activity)

 ![image](https://forum.intervals.icu/uploads/default/original/3X/2/3/231081f1337635a9c929c737c2643160d1b60659.png)

---

<div class="post-metadata">

**Author:** ![R2Tom](https://forum.intervals.icu/user_avatar/forum.intervals.icu/r2tom/32/50144_2.png) [@R2Tom](https://forum.intervals.icu/u/R2Tom)\
**Post date:** [3 March 2025 05:44 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/83 "2025-03-03T05:44:48Z")

</div>

Should be possible to create an field with this:

> [@Server side data model for scripts](https://forum.intervals.icu/t/server-side-data-model-for-scripts/25781/16):
>
> ### JsDataCurveFactory
> 
> Factory and cache for power, hr, GAP or pace curves for an athlete with a given start date.
> 
> - Use 42d, 84d etc. to get curve for given number of days
> - Use s0, s1 etc. for this season, last season and so on
> - Add -kj0 or -kj1 (e.g. 42d-kj0) to get fatigued curves (power only)
> 
> Example usage in a custom activity chart script:
> 
> ```auto
> let mmp42d = icu.bestPower['42d']
> let best5mWatts = mmp42d.getWatts(5 * 60)
> 
> ```

---

<div class="post-metadata">

**Author:** ![Jan\_T](https://forum.intervals.icu/user_avatar/forum.intervals.icu/jan_t/32/52795_2.png) [@Jan\_T](https://forum.intervals.icu/u/Jan_T)\
**Post date:** [6 March 2025 15:39 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/84 "2025-03-06T15:39:37Z")

</div>

General question about fields:  
Understand there are different categories of fields like, interval, activity, wellness, etc. Are there also fields for a single day? Struggling with situations where there are multiple activities logged on one day, and would like to calculate for example the load accumulated for a specific day.

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [6 March 2025 18:31 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/85 "2025-03-06T18:31:00Z")

</div>

For custom activity fields you can control how values from multiple activities are aggregated for the /fitness page on the description tab:

 ![Screenshot 2025-03-06 at 20.27.56](https://forum.intervals.icu/uploads/default/original/3X/5/b/5bcae3c9e2d947edd9295a4e51a0b7a3019cd186.jpeg)

Custom wellness fields calculated using Javascript is on the todo list. There are lots of performance implications. Right now I am busy making Intervals.icu more efficient in this area to reduce the load on the db and thats just for the built in Java calculated fields.

---

<div class="post-metadata">

**Author:** ![Jan\_T](https://forum.intervals.icu/user_avatar/forum.intervals.icu/jan_t/32/52795_2.png) [@Jan\_T](https://forum.intervals.icu/u/Jan_T)\
**Post date:** [7 March 2025 09:17 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/86 "2025-03-07T09:17:16Z")

</div>

Awesome, had missed that! Thank you David!  
Attempting to calculate a fitness chart that includes a load estimation for non-logged activities. There is evidence that total daily active energy is a better predictor of fitness and VO2max than training load. It feels strange to focus completely on the training window and ignore the rest of the day. Imported Active Energy from Apple Health and playing with custom fields.

---

<div class="post-metadata">

**Author:** ![PiotrekNL](https://forum.intervals.icu/user_avatar/forum.intervals.icu/piotreknl/32/52092_2.png) [@PiotrekNL](https://forum.intervals.icu/u/PiotrekNL)\
**Post date:** [9 March 2025 09:04 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/87 "2025-03-09T09:04:36Z")

</div>

If I want to calculate (for example) average power for the whole activity I would use:

> watts = streams.get(“fixed\_watts”).data

and then operate on that.  
Now if I want to calculate average power for a given interval, how do I get “stream” but not for the whole activity but for the chosen interval? In general: how do I get data but only for the interval not the whole activity?

---

<div class="post-metadata">

**Author:** ![R2Tom](https://forum.intervals.icu/user_avatar/forum.intervals.icu/r2tom/32/50144_2.png) [@R2Tom](https://forum.intervals.icu/u/R2Tom)\
**Post date:** [9 March 2025 14:59 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/88 "2025-03-09T14:59:41Z")

</div>

Just replace the temperature with fixed\_watts

> [@Custom interval fields](https://forum.intervals.icu/t/custom-interval-fields/25942/7):
>
> Sure. I added a new public interval field “Average Core Temp” and added that to your interval fields. You should see it in the “Fields” list. The script looks like this: temp = streams.get("core\_temperature").data tot = 0 c = 0 for (let i = interval.start\_index; i \< interval.end\_index; i++) { let v = temp[i] if (v) { tot += v ++c } } c ? tot/c : null I also added “Max Core Temp” if that is what you are after: temp = streams.get("core\_temperature").data max = 0 for (let i = inte…

---

<div class="post-metadata">

**Author:** ![PiotrekNL](https://forum.intervals.icu/user_avatar/forum.intervals.icu/piotreknl/32/52092_2.png) [@PiotrekNL](https://forum.intervals.icu/u/PiotrekNL)\
**Post date:** [9 March 2025 15:32 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/89 "2025-03-09T15:32:40Z")

</div>

Thanks, interval\_start\_index and interval\_end\_index is what I was looking for.

---

<div class="post-metadata">

**Author:** ![PiotrekNL](https://forum.intervals.icu/user_avatar/forum.intervals.icu/piotreknl/32/52092_2.png) [@PiotrekNL](https://forum.intervals.icu/u/PiotrekNL)\
**Post date:** [10 March 2025 10:02 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/90 "2025-03-10T10:02:11Z")

</div>

Is there a way to display custom fields in list view of activities (adding them to columns displayed)? That would make comparing values calculated for them easier. If that’s not possible, what about adding 2-3 default generic empty fields one could use to overwrite from custom field code?

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [10 March 2025 10:09 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/91 "2025-03-10T10:09:30Z")

</div>

You can show custom activity fields in the list view (they are towards the end of the list) but not custom interval fields. To show custom interval fields you need to add an activity field that aggregates the values of the interval fields some how.

---

<div class="post-metadata">

**Author:** ![PiotrekNL](https://forum.intervals.icu/user_avatar/forum.intervals.icu/piotreknl/32/52092_2.png) [@PiotrekNL](https://forum.intervals.icu/u/PiotrekNL)\
**Post date:** [10 March 2025 10:28 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/92 "2025-03-10T10:28:44Z")

</div>

Thanks @david , I missed the distinction between interval and activity fields. All clear now!

---

<div class="post-metadata">

**Author:** ![nfkb](https://forum.intervals.icu/user_avatar/forum.intervals.icu/nfkb/32/30633_2.png) [@nfkb](https://forum.intervals.icu/u/nfkb)\
**Post date:** [14 March 2025 10:50 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/93 "2025-03-14T10:50:52Z")

</div>

Hello,

I am trying to get the MET-min from any activities. David advised me to dig into this area of custom fields.  
MET-min or MET-h are usefull when you dig some medical litterature about physical activity. Usually the big picture of how much you do in a week is written in MET-min or MET-h in papers.

1 MET is 1 metabolic equivalent it’s your energy expenditure at rest, it’s roughlky 1 kcal/kg/h so for a 65 kg guy 1 MET is 65 kcal in one hour.  
If you walk slightly uphill, you are expected to 4x your EE, so walking uphill is 4 MET and doing this for one hour is 260 kcal

Going back to sports. If I do a 750 kcal activity for one hour at 65 kg, I can say that my global energy expenditure is roughly 11,5 MET, that’s a high level activity, it would be something around threshold for on hour. In MET-min it’s simply 690 MET-min

My goal is to have a weekly total MET-min for all activities. Do you think a custom script could do this ?  
For one activity I could get the MET-min doing so :  
energy expenditure from activity in kcal = EE\_ex  
duration in minutes = d\_ex  
weight = w

MET-min = ((EE\_ex/w)/(d\_ex/60)) \* d\_ex  
So for 750 kcal during 75 minutes ((750/65)/(75/60))\*75 → 692 MET-min

I would like to get MET-min from all activities, not only those with kJ supplied by the powermeter. using kJ, david advises me to try  
{  
let kJ = activity.icu\_joules / 1000  
kJmec = kJ / 0.23 // assume 23% efficiency  
let kCal = kJmec \* 0.239  
let hours = activity.elapsed\_time / 3600  
let mets = (kCal / activity.icu\_weight) / hours  
let METmin = mets \* (activity.elapsed\_time)/60  
METmin  
}

it works for biking activites with a PM but not for others…

But I don’t know anything about JS or coding… any good soul to start me up ? thank you

---

<div class="post-metadata">

**Author:** ![R2Tom](https://forum.intervals.icu/user_avatar/forum.intervals.icu/r2tom/32/50144_2.png) [@R2Tom](https://forum.intervals.icu/u/R2Tom)\
**Post date:** [14 March 2025 11:04 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/94 "2025-03-14T11:04:18Z")

</div>

You could use

```auto
activity.calories

```

for activities without powermeter. It is nearly the same as kJ/1000.  
 ![image](https://forum.intervals.icu/uploads/default/original/3X/d/d/dd7349a4deda71e24bfacdc728526f0a1d1575bb.png)

Replace your first line with this:

```auto
let kJ = activity.icu_joules == null ? activity.calories : activity.icu_joules / 1000;

```

---

<div class="post-metadata">

**Author:** ![nfkb](https://forum.intervals.icu/user_avatar/forum.intervals.icu/nfkb/32/30633_2.png) [@nfkb](https://forum.intervals.icu/u/nfkb)\
**Post date:** [14 March 2025 11:40 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/95 "2025-03-14T11:40:30Z")

</div>

Thank you, activity.calories does it 🙂

Now I would love to have this info at the top of any activity and get weekly totals…

---

<div class="post-metadata">

**Author:** ![R2Tom](https://forum.intervals.icu/user_avatar/forum.intervals.icu/r2tom/32/50144_2.png) [@R2Tom](https://forum.intervals.icu/u/R2Tom)\
**Post date:** [14 March 2025 11:49 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/96 "2025-03-14T11:49:49Z")

</div>

> [@nfkb](#):
>
> Now I would love to have this info at the top of any activity and get weekly totals…

1. Reanalyze your activities to fill the custom field
2. Create your custom fitness chart
3. Add it to your calendar view

> [@Add custom fitness plots to the calendar](https://forum.intervals.icu/t/add-custom-fitness-plots-to-the-calendar/55299):
>
> Values from plots on custom charts on the /fitness page can now be added to the calendar. In this example I have added a custom chart showing work done per day (kJ) and the total for each week: To display this data on the calendar click the dot dot dot menu and tick the “Show on calendar” box. Then choose where and how it should be displayed. In this case the Sunday value is displayed in the weekly summary area and in the week popup.

---

<div class="post-metadata">

**Author:** ![nfkb](https://forum.intervals.icu/user_avatar/forum.intervals.icu/nfkb/32/30633_2.png) [@nfkb](https://forum.intervals.icu/u/nfkb)\
**Post date:** [14 March 2025 14:06 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/97 "2025-03-14T14:06:03Z")

</div>

Thank you for helping me @R2Tom but even after reanalyzing my activities, the custom “MET” field does not appear anywhere but on the intervals in activities.

I don’t see it either in the possible datafield in a custom fitness chart. I guess I miss something here

---

<div class="post-metadata">

**Author:** ![david](https://forum.intervals.icu/user_avatar/forum.intervals.icu/david/32/30189_2.png) [@david](https://forum.intervals.icu/u/david)\
**Post date:** [14 March 2025 14:11 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/98 "2025-03-14T14:11:12Z")

</div>

You need to create a custom activity field (for the whole activity) and not a custom interval field (applies to each interval).

 ![Screenshot 2025-03-14 at 16.09.54](https://forum.intervals.icu/uploads/default/original/3X/6/8/68ef22b18d4120ed572b8470f8ee8057d73b871d.png)

It’s a bit confusing unfortunately.

If I understand this correctly the number of METs for an activity is just the calories / weight in kg?

---

<div class="post-metadata">

**Author:** ![nfkb](https://forum.intervals.icu/user_avatar/forum.intervals.icu/nfkb/32/30633_2.png) [@nfkb](https://forum.intervals.icu/u/nfkb)\
**Post date:** [14 March 2025 14:22 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/99 "2025-03-14T14:22:38Z")

</div>

Thank you David,

MET is (kcal/weight)/duration (hours)  
Then MET-min is MET x duration in min

Alleluia ! Now I have to dig how to show a nice moving average tendency 🙂

 ![MET-min](https://forum.intervals.icu/uploads/default/original/3X/e/6/e6b476d85c073da85135b21568dbb746b5f6aa94.jpeg)

---

<div class="post-metadata">

**Author:** ![TimK](https://forum.intervals.icu/user_avatar/forum.intervals.icu/timk/32/44576_2.png) [@TimK](https://forum.intervals.icu/u/TimK)\
**Post date:** [4 September 2025 20:15 UTC](https://forum.intervals.icu/t/custom-interval-fields/25942/100 "2025-09-04T20:15:27Z")

</div>

I added a custom field for RE as

```auto
interval.average_speed / interval.average_watts * activity.icu_weight

```

But in any activity the field shows empty until I “edit” it again.  
Is there a way to make it show automatically, like the built-in fields?

[Previous page](https://forum.intervals.icu/t/custom-interval-fields/25942.md?page=4)

[Next page](https://forum.intervals.icu/t/custom-interval-fields/25942.md?page=6)
