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, 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
It worked!! thank ou very much!