Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
PrachiD
Helper I
Helper I

Calculate Moving Average

Moving average.PNG

 

Hello,

Need help for the following
I want to calculate average colunm as show in the above fig.

The formula to calculate the Average is for April month it will remain as it is but for May it should calculate likewise :- count of april + count of May Divide by 2 ( e.g(5+10)/2) so that i will get the value as 7.5

for june it should calculate likewise:- count of april + count of May+count of June  Divide by 3 ( e.g(5+10+15)/3) so that i will get the value as 10.

1 ACCEPTED SOLUTION

4 REPLIES 4
Zubair_Muhammad
Community Champion
Community Champion

HI @PrachiD

 

Try this

 

Try this solution.

If you donot have a column for Month Numbers... add this calculated column

 

Month_Number =
SWITCH (
    TableName[Month],
    "January", 1,
    "February", 2,
    "March", 3,
    "April", 4,
    "May", 5,
    "June", 6,
    "July", 7,
    "August", 8,
    "September", 9,
    "October", 10,
    "November", 11,
    "December", 12
)

 

Now you can use this MEASURE

 

Average =
CALCULATE (
    AVERAGE ( TableName[Count] ),
    FILTER (
        ALL ( TableName ),
        TableName[Month_Number] <= SELECTEDVALUE ( TableName[Month_Number] )
    )
)

Regards
Zubair

Please try my custom visuals

@PrachiD

 

1007.png


Regards
Zubair

Please try my custom visuals

Count in the above column is of Person ID how can I manage Average and Count in same measure or Column because I want distinct count for Person ID with Moving Average

Thank you Smiley Happy

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.