Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Weighted Average Recalculation when filtered

Good Evening,   I am trying to work out the contribution of the calculation of Days taken to pay when I apply various filters.  looking at the total data set, I have a column in Power Query that c...
  • v-yingjl's avatar
    v-yingjl
    5 years ago

    Hi Anonymous ,

    You can add another filter condition in the formula:

    Measure_Contribution =
    CALCULATE (
        AVERAGE ( 'Table'[Days] ),
        FILTER (
            ALLSELECTED ( 'Table'[Quarter] ),
            'Table'[Quarter] IN DISTINCT ( 'Table'[Quarter] ) &&
            'Table'[Terms] IN DISTINCT ( 'Table'[Terms] )
        )
    )

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • v-yingjl's avatar
    v-yingjl
    5 years ago

    Hi Anonymous ,

    You should want to correct the total value so that the values in the matrix shows the average value, and the total shows the sum value.

    Besides the average measure previous and the second measure you have created by yourself, you can create this measrue to combine them to adjust the column total value in matrix:

    Re =
    IF (
        HASONEVALUE ( 'Table'[Terms] ),
        [Average_Contribution],
        [Sum_Contribution]
    )
    

    The result and the comparsion should be like this:

     

    Best Regards,
    Community Support Team _ Yingjie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.