Forum Discussion
Calculate HR trend graph
- 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
Thank you so much!
This is working perfectly - you are amazing at this :)
I've learnt a lot from this.
Cheers
Simon
You're welcome.:smileyvery-happy:
If any further questions when using Power BI, please feel free to post.
We will always be happy to help.
Regards