Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
9 years ago
Solved

Dynamic table calculations based on slicer

I have a relatively simple summarised table in PowerBI relating to working hours by employees. See below.   The table is a simple summary of Duration Hours and Billable Hours by User, and I'm...
  • prakash_gautam's avatar
    9 years ago

    If you simply create a calculated field (measure) instead of a calculated column, your formula should work:

     

    Billable% = DIVIDE (SUM(tblTime[BillableHours]), SUM(tblTime[DurationHours]))

     

    If you want a calculated column for any reason, this should work:

     

    Billable% =
    CALCULATE (
    SUM ( tblTime[BillableHours] ),
    FILTER ( tblTime, tblTime[User] = EARLIER ( tblTime[User] ) )
    )

     

    you can also add a AND condition if you want in the above formula as:

     

    && tblTime[Team] = EARLIER ( tblTime[Team]) 

     

    Thanks