Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Max(Date) returning dates earlier

hello! I am trying to calculate Employee data as at a point in time.   My Employee data table has report run date and the active employees at each report date. For example Employee ID Report D...
  • Anonymous's avatar
    Anonymous
    2 years ago

    123abc Thanks for your contribution on this tread.

    Hi Anonymous ,

    123abc provided a solution by creating a calculated column. You can make a little adjustment on the formula of your measure as below to get the expected result.

    Headcount =
    VAR MaxReportDate =
        CALCULATE (
            MAX ( 'FACT Workforce Data'[Report Date] ),
            ALLSELECTED ( 'FACT Workforce Data' )
        )
    RETURN
        CALCULATE (
            DISTINCTCOUNT ( 'FACT Workforce Data'[Employee ID] ),
            FILTER (
                'FACT Workforce Data',
                'FACT Workforce Data'[Report Date] = MaxReportDate
                    && 'FACT Workforce Data'[Active Status] = "Active"
            )
        )

    Best Regards