Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Calculating Average in Power BI

Hi There, 

I need help from the Experts on this request: 

- I have a table with columns Import Date, Name and Value (green table shown below) 

- I need to get a Measure to Calculate the 'average' of the column Value by Import Date/Name

- The gray table below shows the expected average value by Import Date/Name. As an example, Peter has 2 as the average and Amy has 3 as the average value on October 1st. 

 

I am not sure how to create this measure... 

 

 

Thanks!

Julio

  • Anonymous 

    you can try to create a measure

    Measure = CALCULATE(AVERAGE('Table'[value]),ALLEXCEPT('Table','Table'[Import Date],'Table'[Name]))

6 Replies

  • MahyarTF's avatar
    MahyarTF
    Icon for Memorable Member rankMemorable Member

    Hi,

    You could use the below code for a created a new table :

    NewTableName = SUMMARIZE(TableName,
                          TableName[Import Date],
                          TableName[Name],
                          "ValueAverage", AVERAGE(TableName[Value])
                        )

     

    Appreciate your Kudos and please mark it as a solution if it helps you.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Mahyar, 

      Thanks for replying to my post. I tested the solution proposed by Ryan above, and the result cams satisfactory for me. I intend to use his measure in a line chart over time, which will work better for me. Apprciate your help also. We have a great community here always available to help... that's awesome! 

      Julio

    • MahyarTF's avatar
      MahyarTF
      Icon for Memorable Member rankMemorable Member

      Also, you could create the Table Visual and select the Average Value for the specific Value field :

       

  • Anonymous 

    you can try to create a measure

    Measure = CALCULATE(AVERAGE('Table'[value]),ALLEXCEPT('Table','Table'[Import Date],'Table'[Name]))

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Ryan, thanks for the solution above. The measure worked perfectly for what I needed... I created it as a new column and told Power Bi to calculate the value as average. thanks for helping with that.