Forum Discussion

ronaldbalza2023's avatar
ronaldbalza2023
Continued Contributor
2 years ago
Solved

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 ...
  • twofingertyper's avatar
    twofingertyper
    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)