Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Get the average value per row with multiple columns

How to get the Average value with rows

As you can see in the table below. I want get the average value for each row.


I have tried so many things.

AVERAGEX(Table, Table[City 1]+Table[City 2]+Table[City 3])

But this give me the SUM.

I also would like to get median value as well.

ColorCity 1City 2City 3Avreage
Yellow2765
Blue10101010
Green12895752,66667


I hope the comunity can help me 🙂

  • Anonymous , do you have these cities as separate columns? I would unpivot them first, otherwise you'll have to define each value with SELECTEDVALUE, for example AVERAGEX(Table, SELECTEDVALUE ( Table[City 1] )+ ... ).

4 Replies

  • ERD's avatar
    ERD
    Icon for Community Champion rankCommunity Champion

    Anonymous , do you have these cities as separate columns? I would unpivot them first, otherwise you'll have to define each value with SELECTEDVALUE, for example AVERAGEX(Table, SELECTEDVALUE ( Table[City 1] )+ ... ).

    • Anonymous's avatar
      Anonymous
      Not applicable

      I did use the unpivot and then i used Averagex and filter togheter and it worked perfect.
      Whit this i understand how work with the tables.
      So thanx!

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Nate123 

    Yes i can, but i want this to be dynamic.

    I want to know why this is acting like it does. I can use other DAX to get the average.