
1. Re: Problem with Date Different Calculation
Jim Dehner Mar 16, 2018 7:13 AM (in response to Wui Heng Goh)good morning
I am confused on your expectations 
your formula is comparing each date to the one before it  is that what you wanted or did you want to compare each date to the first date for each patient
if it is the second the formula would be
DATEDIFF('day', window_min(MIN([Collection Date])),LOOKUP(MIN([Collection Date]), 0))
and will return this
your workbook is attached
Jim
If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution. Thank you.

UricAcidTest_v10.2.twbx 364.7 KB


2. Re: Problem with Date Different Calculation
Wui Heng Goh Mar 18, 2018 6:38 PM (in response to Jim Dehner)Thanks Jim. The formula works well for me.
DATEDIFF('day', window_min(MIN([Collection Date])),LOOKUP(MIN([Collection Date]), 0))
Can you let me know how to use "window_min" and the lookup with offset 0?
Thank you.

3. Re: Problem with Date Different Calculation
Jim Dehner Mar 19, 2018 5:48 AM (in response to Wui Heng Goh)the 2 formulas are table calculations  windowmin looks at the whats in the viz and takes the min value but bear in mind that it is taking the min of the aggregate value in the expression  that aggregate can be any function sum(), avg(), min(), max() etc
Lookup with 0 just takes the value of the current position in the table  think like lookup , 1 goes back 1 position  lookup 0 is just the current position
Jim
If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution. Thank you.