4 Replies Latest reply: Oct 9, 2016 3:32 PM by Marius Larsen

# help with expression "degreeday"

Hello

i have a dimension, "Temperature" °C that shows each temp pr hour. i need to calculate something called "degreeday".

Can somebody help me with this:

if average day temperature >=17 then show 0.

AVG day temperature - 17 = "degreeday"

exsample: if the average day temperature was -5 °C, then the degreeday will be 21

if the avreage day temperature was 4 °C, then the degreeday will be 13.

• ###### Re: help with expression "degreeday"

try something like this .. aggr( if(avg(temperature) >=17, 0, avg(temperature)-17), Date)

• ###### Re: help with expression "degreeday"

Hi, tanks. it was almost right!

Just one problem, why does it returns negative values? -

• ###### Re: help with expression "degreeday"

Got it; aggr(if(avg(kWhTemp) >=17, 0, 17-avg(kWhTemp)), Dato)

Thaks

• ###### Re: help with expression "degreeday"

Hi Marius,

First you need to work out the average temperature per day. Use the Aggr function for this. Subtract 17 from that and then wrap in a rangemin function to return the calculated result or zero, whichever is lower.

RangeMin(aggr(avg(Temperature),Day)-17,0)

Cheers

Andrew