Forum Discussion

sebasjun's avatar
sebasjun
Helper I
8 years ago
Solved

SUMX with calculate average

Hello   I need apply this function        I created a simple datatable       AVGx = AVERAGE(Table1[x]) Measure Manual = SUMX(Table1; Table1[x] - 14) Measure Calc = SUMX(Ta...
  • OwenAuger's avatar
    8 years ago

    Hello sebasjun

    Try this - storing the average in a variable. Previously when the [AVGx] measure was computed in the context of each row, context transition meant that it was just averaging the value on that row.

    Measure Calc =
    VAR Avg = [AVGx]
    RETURN
      SUMX ( Table1; ( Table1[x] - Avg ) )
  • Stachu's avatar
    Stachu
    8 years ago

    I think the average has to be either with ALL or ALLSELECTED

    AVGx:=CALCULATE(AVERAGE(Table1[x]),ALLSELECTED(Table1[x]))