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
mpoche
Frequent Visitor

Trailing Averages (of Monthly Average)

Hi Power Bi Community,

 

I am trying to calcuate the trailing 12 month's average of the monthly average (Beginning Inventory + Ending Inventory / 2). This is to calculate the Inventory Turnover formula (Cost of Goods Sold / Average Inventory). This is always based on the trailing 12 months.

 

I start with calculating the monthly average:

Monthly Avg = 
CALCULATE (
    [Inventory Value],
    DATESINPERIOD ( Date_Lookup[Date], LASTDATE ( Date_Lookup[Date] ), -2, MONTH )
) / 2

 

 Then I use the following measure to try and calculate the trailing 12 months average of the monthly averages:

TTM Monthly Avg. = 
CALCULATE(
    [Monthly Avg],
    DATESINPERIOD(Date_Lookup[Date],LASTDATE(Date_Lookup[Date]),-12,MONTH
    )
) / 12

 

However, that calcuates the applicable monthly average and divides only that month by 12 and does not sum up the trailing 12 monthly averages.

 

Any help is appreciated.

 

Thanks

3 REPLIES 3
Greg_Deckler
Super User
Super User

@mpoche Try this: Better Rolling Average - Microsoft Power BI Community


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

But will this only do the rolling average of my inventory value? Or will it do the average of the monthly average?

 

In the _StartDate variable, how do you make the Day always the last day of that month?

mpoche
Frequent Visitor

Here is a sample of what the outcome is of the previous 12 months:

 

End of MonthInventory ValueMonthly AvgTTM Monthly Avg.
10/31/2021$8,474,154.17 $668,532.56
11/30/2021$8,289,281.09$8,381,717.63$698,476.47
12/31/2021$8,064,217.09$8,176,749.09$681,395.76
1/31/2022$8,092,898.27$8,078,557.68$673,213.14
2/28/2022$8,844,389.56$8,468,643.91$705,720.33
3/31/2022$9,994,850.58$9,419,620.07$784,968.34
4/30/2022$10,040,748.89$10,017,799.73$834,816.64
5/31/2022$9,214,557.29$9,627,653.09$802,304.42
6/30/2022$9,373,298.02$9,293,927.65$774,493.97
7/31/2022$10,339,076.95$9,856,187.48$821,348.96
8/31/2022$12,050,477.58$11,194,777.26$932,898.11
9/30/2022$11,826,241.00$11,938,359.29$994,863.27
10/31/2022$11,314,526.98$11,570,383.99$964,198.67

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.

Top Solution Authors