Forum Discussion

Chmielo's avatar
Chmielo
Frequent Visitor
5 years ago
Solved

Calculations based on a specific value in the range

Hi, I need to create a column based on the difference from column "Value", and the average value of the date range given in slicer. For example: Actual Table Date Value 2021-01-01  5 20...
  • Fowmy's avatar
    5 years ago

    Chmielo 

    You can create a measure for this because a calculated column cannot access the values selected in the slicer. 

    New Value = 
    
    var _avg = CALCULATE( AVERAGE(Table1[Value]), ALLSELECTED(Table1[Date]) )
    var _value = 
        AVERAGEX(
            Table1,
            (Table1[Value] - _avg ) ^ 2
        )
    
    return
        _value