Dan Kellem Posted December 12, 2022 Share Posted December 12, 2022 Given a data set like this:Group Index Data CalcA 1 a 0A 2 b b-aA 3 c c-bA 4 d d-cA 5 e e-dB 1 f 0B 2 g g-fB 3 h h-gB 4 i i-hB 5 j j-iFor a given row (like Group A, Index 3), how would you create a calculated column as the difference from the data in that cell © with the data in the same Group, but prior Index (b)? The first row in each group is handled easily with a case statement.Spreadsheet w/ data above attached.Thanks! Link to comment Share on other sites More sharing options...
Dan Kellem Posted December 13, 2022 Author Share Posted December 13, 2022 The solution:Add a calculated column to grab the value from the previous row:[Data] - first([Data]) over (intersect([Group],Previous([index])))Then add another calculated column with a CASE statement to handle the 0 on rows with Index = 1. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now