Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Calculate average instead Total in Matrix subtotals

Hello, The matrix in the screenshot below compares two dates based on the date selection from the left filters. I want to re-create the measure “Labour_Hour_Compare” to calculate the average instea...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

     

    Try this measure

    Labour_Hour_Compare = 
    VAR selected_Date =
        SELECTEDVALUE ( 'Dates'[Date], MAX ( 'Dates'[Date] ) )
    return AVERAGEX(KEEPFILTERS(VALUES('Sample Date'[HourDesc])),CALCULATE ( SUM ( 'Sample Date'[Labour_Hours] ), 'Sample Date'[Date] = selected_Date )
    )

     

    Reference: https://community.powerbi.com/t5/Desktop/Avg-Subtotal/td-p/636622

     

     

     

    Best Regards,

    Stephen Tao

     

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