Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
In my data,i have hiredate and termination date columns,based on that i need to arrive the total employee count for each year
Solved! Go to Solution.
Hi @Target ,
Thank you for @bhanu_gautam answer , and I have other suggestions for you:
Below is my Date table(indicate this customer activity time):
Below is my hiredate and termination date table:
You can create a new column to judge the customer whether work in company:
IsActive =
VAR CurrentDate = 'Date'[Date]
RETURN
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[hiredate] <= CurrentDate &&
(ISBLANK('Table'[termination date]) || 'Table'[termination date] >= CurrentDate)
)
)
And then you can create a measure to calculate the number of the customer:
ActiveEmployees =
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[hiredate] <= MAX('Date'[Date]) &&
(ISBLANK('Table'[termination date]) || 'Table'[termination date] >= MIN('Date'[Date]))
)
)
The final output will be like this:
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Target ,
Thank you for @bhanu_gautam answer , and I have other suggestions for you:
Below is my Date table(indicate this customer activity time):
Below is my hiredate and termination date table:
You can create a new column to judge the customer whether work in company:
IsActive =
VAR CurrentDate = 'Date'[Date]
RETURN
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[hiredate] <= CurrentDate &&
(ISBLANK('Table'[termination date]) || 'Table'[termination date] >= CurrentDate)
)
)
And then you can create a measure to calculate the number of the customer:
ActiveEmployees =
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[hiredate] <= MAX('Date'[Date]) &&
(ISBLANK('Table'[termination date]) || 'Table'[termination date] >= MIN('Date'[Date]))
)
)
The final output will be like this:
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
IsActive =
VAR CurrentDate = 'DateTable'[Date]
Here DateTable[Date] is derived from calendarAuto fuction?
Yes, it is a date table
Proud to be a Super User! |
|
@Target ,Add calculated columns to determine if an employee was active in a given year. You can do this by creating a column in your date table that checks if the date falls between the hire date and termination date.
IsActive =
VAR CurrentDate = 'DateTable'[Date]
RETURN
CALCULATE(
COUNTROWS('YourTable'),
FILTER(
'YourTable',
'YourTable'[hiredate] <= CurrentDate &&
(ISBLANK('YourTable'[terminationdate]) || 'YourTable'[terminationdate] >= CurrentDate)
)
)
Than create a measure for active employee
Proud to be a Super User! |
|
It shows error
User | Count |
---|---|
117 | |
75 | |
62 | |
50 | |
44 |
User | Count |
---|---|
174 | |
125 | |
60 | |
60 | |
57 |