Forum Discussion
Calendar
- 7 years ago
hi, imy
The Headcount table is linked to the Date table by the Hiredate Many to one.
You couldn't link it to date table.
here are two ways for you refer to:
1. Use this formula to add a measure directly.
Count of Active Employee = VAR currentDate = MAX ( 'Date'[Date] ) RETURN CALCULATE ( COUNTROWS ( Headcount ), FILTER ( Headcount, ( Headcount[Hire Date] <= currentDate && Headcount[Today] >= currentDate ) ) )Then drag date column from date table and this measure into a bar chart
2. Use this formula create a new table
Table = FILTER(CROSSJOIN(Headcount,'Date'),'Date'[Date]>=Headcount[Hire Date]&&'Date'[Date]<=Headcount[Today])
Then create a measure by this formula
countHeader = CALCULATE(DISTINCTCOUNT('Table'[Name]))Now drag Date field from this new table and the measure into a bar chart.
Result:
and here is sample pbix file, please try it,
Best Regards,
Lin
hi,
Thank you for your answer. I will try to be more specific.
My sample data od the Headcount table is this:
| Name | Hire Date | Status | Today |
| Craig | 15/04/2019 | Permanent | 13/05/2019 |
| Vivek | 01/03/2019 | Fix Term | 13/05/2019 |
| Dionysios | 01/01/2019 | Permanent | 13/05/2019 |
| Paulo | 01/10/2018 | Fix Term | 13/05/2019 |
| Ricardo | 24/09/2018 | Fix Term | 13/05/2019 |
| Sueann | 01/07/2018 | Fix Term | 13/05/2019 |
| Cornelis | 01/09/2017 | Fix Term | 13/05/2019 |
| Davey | 12/01/2017 | Permanent | 13/05/2019 |
| Alice | 03/10/2016 | Permanent | 13/05/2019 |
| Stefano | 10/02/2015 | Permanent | 13/05/2019 |
I have a Date table:
I would like to see how many employees I have per year and then drill by month in a bar chart (sorry I can't paste it here).
At the moment I get the chart showing only new hired employees by month rather than total employees working by month. What am I doing wrong?
Many thanks for your support!
Imy
hi, imy
The Headcount table is linked to the Date table by the Hiredate Many to one.
You couldn't link it to date table.
here are two ways for you refer to:
1. Use this formula to add a measure directly.
Count of Active Employee =
VAR currentDate =
MAX ( 'Date'[Date] )
RETURN
CALCULATE (
COUNTROWS ( Headcount ),
FILTER (
Headcount,
( Headcount[Hire Date] <= currentDate
&& Headcount[Today] >= currentDate )
)
)
Then drag date column from date table and this measure into a bar chart
2. Use this formula create a new table
Table = FILTER(CROSSJOIN(Headcount,'Date'),'Date'[Date]>=Headcount[Hire Date]&&'Date'[Date]<=Headcount[Today])
Then create a measure by this formula
countHeader = CALCULATE(DISTINCTCOUNT('Table'[Name]))
Now drag Date field from this new table and the measure into a bar chart.
Result:
and here is sample pbix file, please try it,
Best Regards,
Lin
- imy7 years agoHelper I
It worked!! thank ou very much!