Forum Discussion

MarshalSK's avatar
MarshalSK
Resolver I
2 years ago
Solved

Average per year

Hi Folks, Need quick help to get average. Sharing sample dataset and expected result.   Date Sales 01-Jan-22 100 01-Feb-22 125 01-Mar-22 150 01-Apr-22 175 01-May-22 20...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi MarshalSK ,

     

    We can create a measure.

    avg = 
    var _sales=CALCULATE(SUM('Table'[Sales]),FILTER(ALLSELECTED('Table'),'Table'[Date].[Year]=MAX('Table'[Date].[Year]) ))
    var _months=CALCULATE(DISTINCTCOUNT('Table'[Date].[Month]),FILTER(ALLSELECTED('Table'),'Table'[Date].[Year]=MAX('Table'[Date].[Year])))
    RETURN DIVIDE(_sales,_months,0)

    Then the result is as follows.

    If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

     

    Best Regards,

    Neeko Tang

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