Forum Discussion
Count Of Days
- 8 years ago
hI Rustami4
Try this as a measure:
COUNT OF DAYS = VAR START_DATE_ = CALCULATE ( MIN ( 'Table'[Date In] ), ALLEXCEPT ( 'Table', 'Table'[Well #] ) ) VAR END_DATE_ = CALCULATE ( MAX ( 'Table'[Date Out] ), ALLEXCEPT ( 'Table', 'Table'[Well #] ) ) RETURN DATEDIFF ( START_DATE_, END_DATE_, DAY )START_DATE_ computes for the earliest Date In of a Well #. END_DATE_ computes for the latest Date Out of a Well #
The value being returned is the difference between the two. If you place this measure in a table, you will be seeing the same Count of Days for the same Well # regardless of its dates in and out.
You almost get my idea.
I'll try to express differently
well# date IN date OUT
123 03/04/18 03/15/18
.....
123 03/17/18 03/23/18
230 05/19/18 05/27/18
.....
230 05/28/18 06/02/18
Every row in this table is a separate run. Do not pay attention why every well has a few rows, it can probably have a dozen of them.
So..the desired decision for well#123 is number of days between 03/04/18 (the day it's been spudded, initial) and 03/23/18 (the day it's been finished, final day) and futher for every well number in the first column
hI Rustami4
Try this as a measure:
COUNT OF DAYS =
VAR START_DATE_ =
CALCULATE ( MIN ( 'Table'[Date In] ), ALLEXCEPT ( 'Table', 'Table'[Well #] ) )
VAR END_DATE_ =
CALCULATE ( MAX ( 'Table'[Date Out] ), ALLEXCEPT ( 'Table', 'Table'[Well #] ) )
RETURN
DATEDIFF ( START_DATE_, END_DATE_, DAY )
START_DATE_ computes for the earliest Date In of a Well #. END_DATE_ computes for the latest Date Out of a Well #
The value being returned is the difference between the two. If you place this measure in a table, you will be seeing the same Count of Days for the same Well # regardless of its dates in and out.