Subscribe Bookmark RSS Feed

Determine column mean by day and within certain hours

terapin

Community Trekker

Joined:

Jun 23, 2011

Hi Folks,

I have some hourly data and I'm trying to calculate the mean of variable x for each Day when Hour >= 1 and <=10.  I need to store this computed value in column y for each hour of each day.  I have tried Column Mean by Day where I've excluded all hours that fall outside 1 & 10, but Column Mean calculates the value for all data by Day regardless of what's been excluded.  Any suggestions on how to accomplish this using either a formula for column y or in JSL would be greatly appreciated.  Thanks

Day Hour x y

1    1    5    5.6

1    2    5    5.6

1    3    5    5.6

1    4    5    5.6

1    5    5    5.6

1    6    6    5.6

1    7    6    5.6

1    8    6    5.6

1    9    6    5.6

1    10    7    5.6

1    11    7    5.6

1    12    7    5.6

1    13    8    5.6

1    14    8    5.6

1    15    8    5.6

1    16    8    5.6

1    17    4    5.6

1    18    4    5.6

1    19    4    5.6

1    20    3    5.6

1    21    3    5.6

1    22    3    5.6

1    23    3    5.6

1    24    3    5.6

2    1    1    5.2

2    2    1    5.2

2    3    1    5.2

2    4    5    5.2

2    5    5    5.2

2    6    6    5.2

2    7    6    5.2

2    8    6    5.2

2    9    6    5.2

2    10    15    5.2

2    11    15    5.2

2    12    10    5.2

2    13    8    5.2

2    14    8    5.2

2    15    8    5.2

2    16    8    5.2

2    17    1    5.2

2    18    1    5.2

2    19    1    5.2

2    20    1    5.2

2    21    1    5.2

2    22    3    5.2

2    23    3    5.2

2    24    3    5.2

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Don't know how efficient this is compared to other possibilities but try this as a column formula:

Col Mean( If( 1 <= :Hour <= 10, :x, Empty() ), :Day )

2 REPLIES
Solution

Don't know how efficient this is compared to other possibilities but try this as a column formula:

Col Mean( If( 1 <= :Hour <= 10, :x, Empty() ), :Day )

terapin

Community Trekker

Joined:

Jun 23, 2011

mpb,

Thanks. Your suggestion works great.  I tried the If statement many times, but had the wrong format for it to work properly.