Forum Discussion
Employee Headcount
- 1 year ago
Shrujan1612 , Try using below measure
CumulativeHeadcount =
VAR MaxDate = MAX('Time'[CALENDAR_DATE])
VAR MinDate = EDATE(MaxDate, -11) -- This will get the date 11 months before the MaxDate
RETURN
CALCULATE(
SUM(Employee[Headcount]),
FILTER(
ALL('Time'),
'Time'[CALENDAR_DATE] >= MinDate && 'Time'[CALENDAR_DATE] <= MaxDate
)
) - Anonymous1 year ago
Hi, Shrujan1612
Thanks for the reply from bhanu_gautam, please allow me to provide addition:
Based on your information, I create sample tables:
Employee table
Table
Since I didn't have accurate information about the people, I just summarized it into how many people there were in each month when I created the sample Employee table.
Then create measures Headcount and cumulative headcount, try the following dax:
HEADCOUNT = SUM('Empolyee'[EMPLOYEE])CUMULATIVE HEADCOUNT = VAR MaxDate = MAX('Time'[CALENDAR_DATE]) VAR MinDate = EDATE(MaxDate, -11) RETURN CALCULATE( [HEADCOUNT], FILTER( ALL('Time'), 'Time'[CALENDAR_DATE] >= MinDate && 'Time'[CALENDAR_DATE] <= MaxDate ) )Create a table visual and put fields in table view, here is my preview:
How to Get Your Question Answered Quickly
Best Regards
Yongkang Hua
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Shrujan1612 , Try using below measure
CumulativeHeadcount =
VAR MaxDate = MAX('Time'[CALENDAR_DATE])
VAR MinDate = EDATE(MaxDate, -11) -- This will get the date 11 months before the MaxDate
RETURN
CALCULATE(
SUM(Employee[Headcount]),
FILTER(
ALL('Time'),
'Time'[CALENDAR_DATE] >= MinDate && 'Time'[CALENDAR_DATE] <= MaxDate
)
)
- Shrujan16121 year agoHelper I
Headcount is a measure we cant use it in sum.
- bhanu_gautam1 year agoSuper User
Shrujan1612 , try this then
CumulativeHeadcount =
VAR MaxDate = MAX('Time'[CALENDAR_DATE])
VAR MinDate = EDATE(MaxDate, -12)
RETURN
CALCULATE(
SUMX(
FILTER(
ALL('Time'),
'Time'[CALENDAR_DATE] >= MinDate &&
'Time'[CALENDAR_DATE] <= MaxDate
),
[Headcount]
)
)