Forum Discussion

pva's avatar
pva
Frequent Visitor
4 years ago
Solved

Average calculation

Hi all! I want to calculate an average this way   I have this table:     Code Period Hours 5125 201902 2 5125 201903 4 5125 201903 6 5125 201904 3 5125 201905 4 ...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi pva 

    How did you get 4.5 when you use (2+5+3+4)/4 ? The correct answer is 3.5 .

    For 5125 , the final result is 3.5 -> ((4+6)/2+2+3+4)/4 .For 2147 , the final result is 4.667 -> ((2+4)/2+8+3)/3 . So the final average is 4.08 ->(3.5+4.667)/2

    To realize the final average , you need to nest an AVERAGEX() outside the formula provided by SU .

    Avg =AVERAGEX(VALUES('Table'[Code]),calculate(AVERAGEX(VALUES('Table'[Period]),CALCULATE(AVERAGE('Table'[Hours])))))

    The final result is as shown :

     

    I have attached my pbix file , you can refer to it .

     

    Best Regard

    Community Support Team _ Ailsa Tao

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.