Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How can I calculate average for multiple columns?

I have 100+ columns and need an average for each one but don't want to create 100+ measures to compute the average for each one. Is there a faster way to do this, e.g. can I make just one measure and calculate an average for every column inside it?

9 Replies

  • Anonymous 

    maybe you can try to unpivot those columns. 

    then you can get different average value by filter the Attribute value.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks ryan_mayu 

       

      I've unpivoted the columns but not sure how I can filter the average by attribute value. I created a measure from the unpivoted column using the below code but this gives an average for all the different columns combined. How do i filter this by attribute now?

      average = sum(table[value])/count(table[value])

       

      • ryan_mayu's avatar
        ryan_mayu
        Icon for Super User rankSuper User

        Anonymous 

        could you pls provide the sample data and expected output?