Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Issues with average per category

  Hi,   I'm struggling with calculation avg salary per category. I've created two measures: Salary, EUR = var admission = IFERROR(CALCULATE(SUM('PI Entires'[Amount]); FILTER('PI Entires';...
  • sturlaws's avatar
    7 years ago

    I got the values to correspond with your desired value by using this

    AVG Position type =
    IF (
        NOT ( ISBLANK ( [Salary. EUR] ) );
        CALCULATE (
            [AVG Salary per employee];
            ALL ( Employee );
            KEEPFILTERS ( Position )
        );
        BLANK ()
    )

    But are you sure your model is correct? I have not gone into details of it, but for the 2 employees without a position type the salaries are 424,95 and 156,99, while the total for this blank position type 1353,69. You might have some issues with the bidirectional filters you have set up, from 'Appointments' there are two possible paths to 'PI Entires', and this is something that might cause some issues: https://www.sqlbi.com/articles/bidirectional-relationships-and-ambiguity-in-dax/