Subscribe Bookmark RSS Feed

How do I use an if statement and a by variable correctly in a column mean formula?

rperkins

New Contributor

Joined:

Jun 9, 2017

I'm trying to use the columne mean formula to show the Time 0 average value for a columen of test samples, grouped by the test sample types. 

 

I found this topic from 2012, that looked like it would work:

https://community.jmp.com/t5/Discussions/Determine-column-mean-by-day-and-within-certain-hours/m-p/5...

 

The recommended syntax there is:

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

 

However, when I try to use something similar with my data set, I get an "argument should be numeric 1 times at rows: 2" error. 

 

This is the syntax I'm trying to use.

Col Mean(If( :DH hours == 0, :pm_mw, Empty() ), :Substrate)

 

I can get the forumla to execute correctly if I eliminate the by variable: 

Col Mean(If( :DH hours == 0, :pm_mw, Empty() ))

 

Similarly, I can get it to evaluate correctly if I eliminate the I statement:

Col Mean(:pm_mw, :Substrate)

 

And finally, I can get it to evaluate correctly if all the values for DH hours in the table are 0. But if there are any non-0 values for DH hours in the table, it won't evalute. 

 

Any suggestions would be appreciated. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales

Staff

Joined:

Mar 21, 2013

Solution

Instead of empty(), use a missing value, represented by period.

formula column using ColMeanformula column using ColMean

Craige
2 REPLIES
Craige_Hales

Staff

Joined:

Mar 21, 2013

Solution

Instead of empty(), use a missing value, represented by period.

formula column using ColMeanformula column using ColMean

Craige
rperkins

New Contributor

Joined:

Jun 9, 2017

Thanks Craig. This worked.