Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Difference between average and selected value

How to subtract the responding value from the average score in 2021(In this small sanmple data,i.e average of bolding numbers) for all Name   sample data: Name id Date Score A 1 1/9/202...
  • Jihwan_Kim's avatar
    3 years ago

    Hi,

    Please check the below picture and the attached pbix file.

     

    Expected outcome measure: =
    VAR _avg2021 =
        AVERAGEX (
            ADDCOLUMNS (
                FILTER ( ALL ( Data ), YEAR ( Data[Date] ) = 2021 ),
                "@score", [Score measure:]
            ),
            [@score]
        )
    RETURN
        IF ( HASONEVALUE ( Data[Name] ), [Score measure:] - _avg2021 )