- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Evaluating Dif Function by Column
I'm trying to evaluate the difference between two rows using the "Dif" function; however, the evaluation is continuous and has no regard for other columns. For example, with the "Big Class" DT I run the script below, but it will still compute the weight difference between a male and female. Is there any way around this?
dt = Current Data Table();
dt << Sort( By( :age, :sex ), Order( Ascending, Ascending ) );
dt << New Column("Weight Delta", Formula(Dif(:weight)));
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Evaluating Dif Function by Column
Created:
Dec 7, 2018 05:22 PM
| Last Modified: Dec 7, 2018 2:25 PM
(2380 views)
| Posted in reply to message from Ksrzg01 12-07-2018
I believe this formula will do what you want.
If( :sex == Lag( :sex ),
Dif( :weight ),
.
)
Jim