Hi!
I have a table with Headcount and People Costs by month for three organizations. I am trying to create a measure that calculates the YTD average headcount that works with a slicer for organization. An example of the data is below.
Fiscal Month | Organization | Values | Actual |
January | Shared | Headcount | 5 |
January | Premier | Headcount | 10 |
January | MCS | Headcount | 15 |
February | Shared | Headcount | 6 |
February | Premier | Headcount | 11 |
February | MCS | Headcount | 16 |
January | Shared | People Cost | 500 |
January | Premier | People Cost | 1000 |
January | MCS | People Cost | 1500 |
February | Shared | People Cost | 600 |
February | Premier | People Cost | 1100 |
February | MCS | People Cost | 1600 |
The measure I have written is
Actual YTD HC Avg = TOTALYTD( CALCULATE( AVERAGE( 'AAD CPH'[Actual] ) , 'AAD CPH'[Values] = "Headcount" ) , 'Calendar'[Fiscal Month] , "06/01/2017" )
*Calendar is my date table and is mapped to my fiscal month through a mapping table*
It works fine when I have a single organization selected in my slicer. For example, February YTD HC Avg for Shared is returning 5.5 ( Average of 5 & 6).
However, when I select all organizations in the slicer to show the Total, I get 10.5 instead of the expected 31.5 (Average of 30 & 33). I know it's calculating the average of all 6 numbers to get 10.5, but I don't know how to write the formula to cumulate the numbers within a fiscal month before taking the average.