cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Have your say in shaping JMP's future by participating in the new JMP Wish List Prioritization Survey
Choose Language Hide Translation Bar
Vvvv
Level II

Divide column by reference point with conditions

Hi. I have a problem I can't get my head around. 

I am trying to create a new column which consists of another column divided by a reference point, but the problem is I have some conditions to include.

For simplicity I have added a generated datafile which I will refer to.

 

What I want to do is to take column Z and divide it by Z|X=c within each Y-group. The Y-groups are as you can tell not the same size.

 

SO C is the reference point, and for all Y-groups (1-9) I want to take column Z, and divide it by Z|X=c.

That is, in the new column all values where X=c will be 1 and the others will be Z / (Z|X=c).

 

I apologize for not being able to formulate myself in clearer terms, for various reasons I can not show my real dataset and English is not my native tounge. 

 

Any help is greatly appreciated.

V

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Divide column by reference point with conditions

Here is one formula that works

currentY = :Y;
:Z / :Z[(Current Data Table() << get rows where( :X == "c" & :Y == currentY ))[1]];

txnelson_0-1636019077377.png

 

Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Divide column by reference point with conditions

Here is one formula that works

currentY = :Y;
:Z / :Z[(Current Data Table() << get rows where( :X == "c" & :Y == currentY ))[1]];

txnelson_0-1636019077377.png

 

Jim
Vvvv
Level II

Re: Divide column by reference point with conditions

Haha this was way easier than I thought it would be.

 

Thank you very much.