title: Calculate average across multiple columns in same row across entire table in Power BI
body: <p>I would like to calculate the daily average weight gain per day for each row and add the answer in a  a new column. </p>
  
  <p>The variable to calculate the average are located all in the same table (Raw Data) and same row but throughout multiple columns.( Body Weight Yest 1, Body Weight Yes 2).</p>
  
  <p>Not all data is available. <strong>How do I calculate average across multiple columns in same row in Power Bi?</strong> </p>
  
  <p><strong>I have solved the issue by creating following columns with formulas:</strong></p>
  
  <p><strong>Total Across Columns</strong> </p>
  
  <pre><code>Total Across Columns= [Body Weight Yest 1.] + [Body Weight Yest 2.]
  </code></pre>
  
  <p><strong>Non Blank Columns</strong></p>
  
  <pre><code>Non Blank Columns=
  IF ( ISBLANK ( [Body Weight Yest 1.] ), 0, 1 )
    + IF ( ISBLANK ( [Body Weight Yest 2.] ), 0, 1 )
  </code></pre>
  
  <p><strong>Body Weight Daily AVG.</strong></p>
  
  <pre><code>Body Weight Daily AVG = [Total Across Columns] / [Non Blank Columns]
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/XOwxY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XOwxY.png" alt="Data Table for Body Weight Calculation"></a></p>
  
  <p>in Power Query  (Excel Add On):</p>
  
  <pre><code>=IFERROR(AVERAGEIF(Raw Data[@[ Body Weight Yest. 1]:[ Body Weight Yest. 2]];"&lt;&gt;");"")
  </code></pre>
  
  <p><strong>I would like to know if there is a simpler/better solution?</strong></p>