Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
I have the following three piece measures
However when there is a gap in dates, the AverageHC returns incorrect value
For example in above the AverageHC displays 17.5 when it should be 14.25
The basis of the calculation is below
Solved! Go to Solution.
Average HC =
var a = ADDCOLUMNS(VALUES(Headcount[Month]),"CHC",var m=[Month] return CALCULATE(sum(Headcount[HC]),Headcount[Month]=m))
var b = ADDCOLUMNS(a,"PHC",var m=[Month] return if([Month]=0,[CHC],CALCULATE(sum(Headcount[HC]),Headcount[Month]=m-1)))
return averagex(b,DIVIDE([CHC]+[PHC],2,0))
Average HC =
var a = ADDCOLUMNS(VALUES(Headcount[Month]),"CHC",var m=[Month] return CALCULATE(sum(Headcount[HC]),Headcount[Month]=m))
var b = ADDCOLUMNS(a,"PHC",var m=[Month] return if([Month]=0,[CHC],CALCULATE(sum(Headcount[HC]),Headcount[Month]=m-1)))
return averagex(b,DIVIDE([CHC]+[PHC],2,0))
User | Count |
---|---|
89 | |
73 | |
69 | |
65 | |
56 |
User | Count |
---|---|
97 | |
92 | |
85 | |
74 | |
68 |