Forum Discussion

simony's avatar
simony
Frequent Visitor
10 years ago
Solved

Calculate HR trend graph

Hi All, I'm having a bit of an issue working out the measure.  So all I am trying to do is put together a trend graph for how many employees we have at each year, month & Quarter range (depend ...
  • v-micsh-msft's avatar
    v-micsh-msft
    10 years ago

    Simon,

     

    Good Point about replacing the countrows function here.

    For the year HC, I have some consideration here. Let's say one person who joins at 2001.1.1 and leaves at 2001.1.31, when under month range, we will count this one as a head count, right? But when the time range become larger, for 2001 to 2002 this year range, would this person be counted as a head count?

    If the definition of HC is different between month and year, then we might need to add another if to deduct the leavers.

    Using the

    LV Headcounts = CALCULATE(COUNT('June - Data'[Start Date]),

       FILTER('June - Data',

           IF( LASTDATE('Date'[Date])-FIRSTDATE('Date'[Date])<=30,

               IF(value([End date])<>0,[Start Date] <= LASTDATE('Date'[Date]) && [End Date]>=FIRSTDATE('Date'[Date]),[Start Date] <=LASTDATE('Date'[Date]) //for month

                  ),

               IF(value([End date])<>0,[Start Date] <= LASTDATE('Date'[Date]) && [End Date]>=LASTDATE('Date'[Date]), [Start Date] <=LASTDATE('Date'[Date]) //for year

                 )

             )

        )

    )

    This would decute those who leaves before the end of the year.

    Regards