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]))
)
)BI_HCV
6 years agoFrequent Visitor
I know there is a long time ago, but I'm wondering if you have the pbix file to share?
I tried to set my data as you wrote but doesn't works.