Forum Discussion
Anonymous
7 years agoNot applicable
DAX average formula with filter
My dataset captures the following:
| Country | Version | Month | Classification | Line | Data |
| China | Actual | Jan | Total | Direct labour headcount | |
| China | Actual | Feb | Total | Direct labour headcount | |
| China | Budget | separate lines for all 12 months | Total | Direct labour headcount | |
| China | Prior Year | separate lines for all 12 months | Total | Direct labour headcount | |
| China | Actual | Jan | Internal | Direct labour headcount | |
| China | Budget | separate lines for all 12 months | Internal | Direct labour headcount | |
| China | Prior Year | separate lines for all 12 months | Internal | Direct labour headcount | |
| China | Actual | etc | Total | S&M headcount | |
| China | Budget | etc | Total | S&M headcount | |
| China | Prior Year | etc | Total | S&M headcount | |
| etc |
I tried unsuccessfully to create a DAX formula to calculate the average headcount filtered according to country, month, classification and headcount group:
AvgDL = CALCULATE(AVERAGE('Table'[Data]), FILTER(ALLSELECTED(Table), Table[Line] = "Total direct labour", Table[Classification]="FTE Total",Table[Country],Table[Date] ) ) )
Pls advise how to correct this formula.
9 Replies
- AnonymousNot applicable
It looks like you are trying to Average a subset of data and so you should use AVERAGEX formula.
- AnonymousNot applicable
I did, but still get syntax error.
- AnonymousNot applicable
Please share few rows of actual dataset ?