Forum Discussion

bree_carter's avatar
bree_carter
New Member
2 years ago
Solved

calculate % based on multiple criteria

Hi, I have data which shows shift hours, but I need to convert that to a shift quantity (or percentage of the shift on that day for that person). The issue I have is when there are 2 shift types on ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi bree_carter 

    Please try this:

    With your data, I create a calcualte column:

    Calculated Shift = 
    VAR _sumHours = CALCULATE(
                        SUM('Table'[Hours]),
                        FILTER('Table',
                            'Table'[Date]=EARLIER('Table'[Date])
                            &&
                            'Table'[Employee Id]=EARLIER('Table'[Employee Id])
                            )
                        )
    //Get the sum of the Hours separately
    RETURN 'Table'[Hours]/_sumHours

    Select the Column(Calculated Shift) > Column tools > Change the Display the values in this column with commas as a thousand separator to 2

     

    The result is as follow:

     

    Best Regards,

    Zhengdong Xu

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.