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
Anonymous
Not applicable

How to calculate month average from sum?

How to calculate month average from sum?  prefer 12month running average. 

below 'totalAmount' was a 'New Measure'. 

 

CRM.PNG

3 REPLIES 3
v-sihou-msft
Employee
Employee

@Anonymous

 

@GilbertQ's formula should be correct, just change the "SUM" into "AVERAGE". If the dates are not contiguous, you can use AVERAGEX() function. See my sample below;

 

Moving 3 Months Average = 
CALCULATE (
    AVERAGEX ( 'SAMPLE', 'SAMPLE'[REVENUE] ),
    DATESINPERIOD ( 'SAMPLE'[FullDate], LASTDATE ( 'SAMPLE'[FullDate] ), -3, MONTH )
)

5.PNG

 

 

Regards,

Anonymous
Not applicable

@v-sihou-msft Average = calculate(averagex('Master Category',[TotalAmount]),datesinperiod('Calendar'[Date].[Month],lastdate('Calendar'[Date].[Month]),-3,Month))

 

do you know what's wrong? 

what i need is the moving average (new measure) show up as a 'card'.  the 3 month moving average below should be (-252-356-40)/3 = -216. 

 

 

 

CRM.PNG

GilbertQ
Super User
Super User

Hi there you can use the following below.

 

NOTE: You will have to change the dates to be the dates from your table. You could also possibly change it from MONTH to YEAR and make it -1? It just depends on how you want to see it.

 

Moving Total 12 Months = 
CALCULATE (
SUM('Session'[Sessions] ),
    DATESINPERIOD (
        'Date'[FullDate],
        LASTDATE ( 'Date'[FullDate] ),
        -12,
        MONTH
    )
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!







Power BI Blog

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.