Forum Discussion
ronaldbalza2023
2 years agoContinued Contributor
Incorrect Percentage - DAX
Hi everyone, I’m hoping to get some assistance with a DAX measure I created to calculate the percentage of employees in the higher salary range. The overall percentage seems accurate, but when I ...
- 2 years ago
ronaldbalza2023 - as mentioned, just adding in ALL. so your measure became:
% SalaryRangeHigh = VAR TotalActiveEmployees = CALCULATE( COUNTROWS(_EmployeeDetail), ALL (_EmployeeDetail) , ALL (_EmployeeSalary) , _EmployeeDetail[EmploymentStatus] = "Active", NOT ISBLANK(_EmployeeSalary[ Salary ]) ) VAR ActiveEmployeesHigherRange = CALCULATE( COUNTROWS(_EmployeeDetail), ALL (_EmployeeDetail), ALL (_EmployeeSalary) , _EmployeeDetail[EmploymentStatus] = "Active", NOT ISBLANK(_EmployeeSalary[ Salary ]), FILTER( _EmployeeSalary, _EmployeeSalary[ Salary ] >= _EmployeeSalary[SalaryRangeHigh] ) ) RETURN DIVIDE(ActiveEmployeesHigherRange, TotalActiveEmployees)
twofingertyper
2 years agoHelper III
Sorry, had just read the chapter in the guide to DAX and it sounded similar to an example they provided. The filter you provided within the CALCULATE function would still be applied, it just removes any additional filters that may be impacting on the measure.
Apologies if you knew all this already, I am slowly learning things and find it a lot easier currently to work with examples/data rather than just the code, but hopefully someone will be along that knows more than me and can assist.
(sorry, just noticed you uploaded the example, will take a look!)
Good luck with it!