Forum Discussion
BradleyA
9 years agoRegular Visitor
Working with Timespan Data
I am working with data that's has a start date and end date (or null if the engagement has not ended). Between the start and end dates, the engagement is "open" and outside of them, it is "closed". ...
- 9 years ago
You can try measures as below. See more details in the attached pbix file.
IsIncluded = IF ( ( MIN ( 'calendar'[Date] ) >= MAX ( yourTable[Open date] ) && MIN ( 'calendar'[Date] ) <= MAX ( yourTable[Close date] ) ) || ( MAX ( 'calendar'[Date] ) >= MAX ( yourTable[Open date] ) && MAX ( 'calendar'[Date] ) <= MAX ( yourTable[Close date] ) ), 1, BLANK() )includedRecords = CALCULATE ( COUNTROWS ( yourTable ), FILTER ( ALLSELECTED ( yourTable ), ( MIN ( 'calendar'[Date] ) >= yourTable[Open date] && MIN ( 'calendar'[Date] ) <= yourTable[Close date] ) || ( MAX ( 'calendar'[Date] ) >= yourTable[Open date] && MAX ( 'calendar'[Date] ) <= yourTable[Close date] ) ) )
Eric_Zhang
Microsoft Employee
9 years agoYou can try measures as below. See more details in the attached pbix file.
IsIncluded =
IF (
(
MIN ( 'calendar'[Date] ) >= MAX ( yourTable[Open date] )
&& MIN ( 'calendar'[Date] ) <= MAX ( yourTable[Close date] )
)
|| (
MAX ( 'calendar'[Date] ) >= MAX ( yourTable[Open date] )
&& MAX ( 'calendar'[Date] ) <= MAX ( yourTable[Close date] )
),
1,
BLANK()
)
includedRecords =
CALCULATE (
COUNTROWS ( yourTable ),
FILTER (
ALLSELECTED ( yourTable ),
(
MIN ( 'calendar'[Date] ) >= yourTable[Open date]
&& MIN ( 'calendar'[Date] ) <= yourTable[Close date]
)
|| (
MAX ( 'calendar'[Date] ) >= yourTable[Open date]
&& MAX ( 'calendar'[Date] ) <= yourTable[Close date]
)
)
)