Hi Everyone,
I have a fact table that is filled with multiple departments, with multiple headcount types (full time, part time, contractors, etc), spanning several years, at the MONTH LEVEL. Some of the months during the year can have 0 values as well. I am trying to write a formula that calculates the YTD Average HC and can't quite figure it out. I have a Date Table linked to my data set.
When calculating YTD Sales my formula works perfectly:
=Calculate([Actuals (OP2 Rate)],DATESYTD(calendar[date]))
where "Actuals (OP2 Rate)" =calculate(sum(Fact_OpexHC[Amount@OP2Rate]),Fact_OpexHC[Scenario] = "Actuals")
I thought just substituting Average or AverageX for Sum in the formula above would work, but it doesn't.
The first three columns below, Child, MonthNameShort, and Total show the headcount by month in my data model. What I want my Avg YTD HC calc to look like is the 4th column, Avg YTD HC, which I currently don't have in the model. Any help is greatly appreciated!! Thanks, Jim
[TABLE="width: 491"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Child[/TD]
[TD]MonthNameShort[/TD]
[TD]Total[/TD]
[TD] Avg YTD HC[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Jan[/TD]
[TD="align: right"]115.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Feb[/TD]
[TD="align: right"]119.00[/TD]
[TD="align: right"]117.00[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Mar[/TD]
[TD="align: right"]122.00[/TD]
[TD="align: right"]118.67[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Apr[/TD]
[TD="align: right"]126.00[/TD]
[TD="align: right"]120.50[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]May[/TD]
[TD="align: right"]127.00[/TD]
[TD="align: right"]121.80[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Jun[/TD]
[TD="align: right"]129.00[/TD]
[TD="align: right"]123.00[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Jul[/TD]
[TD="align: right"]131.00[/TD]
[TD="align: right"]124.14[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Aug[/TD]
[TD="align: right"]131.00[/TD]
[TD="align: right"]125.00[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Sep[/TD]
[TD="align: right"]131.00[/TD]
[TD="align: right"]125.67[/TD]
[/TR]
</tbody>[/TABLE]
I have a fact table that is filled with multiple departments, with multiple headcount types (full time, part time, contractors, etc), spanning several years, at the MONTH LEVEL. Some of the months during the year can have 0 values as well. I am trying to write a formula that calculates the YTD Average HC and can't quite figure it out. I have a Date Table linked to my data set.
When calculating YTD Sales my formula works perfectly:
=Calculate([Actuals (OP2 Rate)],DATESYTD(calendar[date]))
where "Actuals (OP2 Rate)" =calculate(sum(Fact_OpexHC[Amount@OP2Rate]),Fact_OpexHC[Scenario] = "Actuals")
I thought just substituting Average or AverageX for Sum in the formula above would work, but it doesn't.
The first three columns below, Child, MonthNameShort, and Total show the headcount by month in my data model. What I want my Avg YTD HC calc to look like is the 4th column, Avg YTD HC, which I currently don't have in the model. Any help is greatly appreciated!! Thanks, Jim
[TABLE="width: 491"]
<colgroup><col><col><col><col></colgroup><tbody>[TR]
[TD]Child[/TD]
[TD]MonthNameShort[/TD]
[TD]Total[/TD]
[TD] Avg YTD HC[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Jan[/TD]
[TD="align: right"]115.00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Feb[/TD]
[TD="align: right"]119.00[/TD]
[TD="align: right"]117.00[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Mar[/TD]
[TD="align: right"]122.00[/TD]
[TD="align: right"]118.67[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Apr[/TD]
[TD="align: right"]126.00[/TD]
[TD="align: right"]120.50[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]May[/TD]
[TD="align: right"]127.00[/TD]
[TD="align: right"]121.80[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Jun[/TD]
[TD="align: right"]129.00[/TD]
[TD="align: right"]123.00[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Jul[/TD]
[TD="align: right"]131.00[/TD]
[TD="align: right"]124.14[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Aug[/TD]
[TD="align: right"]131.00[/TD]
[TD="align: right"]125.00[/TD]
[/TR]
[TR]
[TD]S1110 - Salaried Heads[/TD]
[TD]Sep[/TD]
[TD="align: right"]131.00[/TD]
[TD="align: right"]125.67[/TD]
[/TR]
</tbody>[/TABLE]