Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Average

Hi all   I have a table with costs. Some of the Costs have a Call ID and others not. There is also a Cost Category. I'm trying to get the average cost per cost category based on the Distinctcount o...
  • v-frfei-msft's avatar
    v-frfei-msft
    7 years ago

    Hi Anonymous ,

     

    To use the measure as below.

     

    Measure =
    VAR countcall =
        CALCULATE (
            COUNT ( tets[Call ID] ),
            FILTER ( tets, tets[Call ID] <> BLANK () )
        )
    RETURN
        IF (
            ISFILTERED ( tets[INVOICE_ITEM_CATEGORY] ) = FALSE (),
            BLANK (),
            IF (
                ISBLANK ( countcall ),
                AVERAGE ( tets[GBP_AMOUNT] ),
                DIVIDE ( SUM ( tets[GBP_AMOUNT] ), DISTINCTCOUNT ( tets[Call ID] ) )
            )
        )