Forum Discussion

PhilTo1's avatar
PhilTo1
New Member
2 years ago
Solved

% split with multiple criteria

Hi,   I'm a fairly new user to Power BI, apologies if there is a simple answer to this!   I'm working on a payroll report which looks something like                                              ...
  • AndrewGould's avatar
    2 years ago

    Hi Phil,

    If you wanted the second table to have the same layout as the one you showed (I'm guessing you used a Matrix visual?) you could add a measure which divides the salary for each employee and cost code by the total salary for the employee.  Here's a basic version of a measure which would do that:

     

     

    Salary as % of Employee Total Salary = DIVIDE(
        SUM(YourTable[Salary]),
        CALCULATE(
            SUM(YourTable[Salary]),
            REMOVEFILTERS(YourTable[Cost Code])
        )
    )

     

     

    You can format the measure as a percentage using the Measure Tools tab in the ribbon:

     

    And when you create the matrix you'll see results similar to this:

     

    N.B. I used the following mock data:

    Staff NamePeriodCost CodeSalary
    Employee 1Period 1Cost Code 18000
    Employee 1Period 1Cost Code 22000
    Employee 2Period 1Cost Code 16000
    Employee 2Period 1Cost Code 24000
    Employee 1Period 2Cost Code 19000
    Employee 1Period 2Cost Code 21000
    Employee 2Period 2Cost Code 15000
    Employee 2Period 2Cost Code 25000
    Employee 1Period 3Cost Code 17500
    Employee 1Period 3Cost Code 22500
    Employee 2Period 3Cost Code 16500
    Employee 2Period 3Cost Code 33500