cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
chadyoder
Level I

Compute Column Mean while restricting observations used


Hello,

 

I want to get a column mean into a new column but I want to be able to restrict the date range that I use.  I want to be able to say get column mean from day x to day y in my formula.   This is the current formula that i have:

 

New Column ("X",

Numeric,

Continuous,

Format ("Best", 12),

Formula (Col Mean (:WeeklyPercent, :Week, :Source)), Set Selected);

 

 

It pull the average weekly percent by week and source of the data which is perfect, however, even when I put a data filter on the dataset it still pulls the mean for the entire data set by those two by variables.  I want to be able to change the date range that those column means are from.  Can anyone help me with that?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
XanGregg
Staff

Re: Column Mean using only part of the dataset

The column functions operate on the whole table, ignoring selection and exclusions. However, you can make a formula column that's dependent on the row state and use that column as a BY variable.


New Column( "mysel", Formula( Selected( Row State() ) ) );


New Column( "meany", Formula( Col Mean( :y, :mysel) ) );


If you're using the global data filter with selection turned on, the Column Means will be recomputed whenever the selection changes.

View solution in original post

1 REPLY 1
XanGregg
Staff

Re: Column Mean using only part of the dataset

The column functions operate on the whole table, ignoring selection and exclusions. However, you can make a formula column that's dependent on the row state and use that column as a BY variable.


New Column( "mysel", Formula( Selected( Row State() ) ) );


New Column( "meany", Formula( Col Mean( :y, :mysel) ) );


If you're using the global data filter with selection turned on, the Column Means will be recomputed whenever the selection changes.