Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

subtractung average column value from another column values

I have 2 columns

col1        col2

2227
4248
2019
2836
2535

 

I need added col3. the values of col3 is col2-avg(col1)

i.e avg of col1 is 27.4

col3 values are 

27-27.4= -0.4

48-27.4=20.6

19-27.4= -8.4

36-27.4 = 8.6

35-27.4= 7.6

How to calculate this operation in power bi ??

 

 

  • Hi,

     

    Drag Col1 and Col2 fields to the row labels section of your Table/Matrix visual and write this measure

     

    =MIN(Table1[Col2])-CALCULATE(AVERAGE(Table1[Col1]),ALL(Table1))

     

    Hope this helps.

2 Replies

  • Hi,

     

    Drag Col1 and Col2 fields to the row labels section of your Table/Matrix visual and write this measure

     

    =MIN(Table1[Col2])-CALCULATE(AVERAGE(Table1[Col1]),ALL(Table1))

     

    Hope this helps.

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI Anonymous

     

    Try this approach:

     

    Measure = 
    
    VAR vCol1_Avg =CALCULATE(AVERAGE(Table1[Col1]),ALLSELECTED(Table1))
    VAR vCol2_val = MAX(Table1[Col2])
    RETURN
    vCol2_val - vCol_Avg

    Thanks

    Raj