Forum Discussion
danielgatley
8 years agoFrequent Visitor
Complex Filtering with Dates
Hi All, I'm attempting to create a point in time headcount report based on our HR data but i'm having trouble correctly filtering the data. We have a table which is called EmployementRecord (Obv...
- Anonymous8 years ago
You need a date table. Use the date field in this table as a filter in your report and then use this measure:
Measure = VAR selectedDate = SELECTEDVALUE(Date[Date]) RETURN CALCULATE( COUNTROWS(EmployementRecord), FILTER(EmployementRecord, EmployementRecord[StartDate] <= selectedDate && (EmployementRecord[EndDate] >= selectedDate || ISBLANK(EmployementRecord[EndDate])) ) )
Anonymous
8 years agoNot applicable
You need a date table. Use the date field in this table as a filter in your report and then use this measure:
Measure =
VAR selectedDate = SELECTEDVALUE(Date[Date])
RETURN
CALCULATE(
COUNTROWS(EmployementRecord),
FILTER(EmployementRecord,
EmployementRecord[StartDate] <= selectedDate
&& (EmployementRecord[EndDate] >= selectedDate || ISBLANK(EmployementRecord[EndDate]))
)
)danielgatley
8 years agoFrequent Visitor
Thank you for the response SPG, just what I needed.
- shebr8 years agoResolver III
Hey danielgatley
If you need a quick fire way to create a full date table this is a great video.
Thanks
Shebr