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
Fraze
Helper I
Helper I

Converting Calculated Measure to Moving Average

Hello,

 

Re-opening this post with the source file from the start: https://1drv.ms/u/s!AuZqEDLABUeQgs4umqr7okhOnjzpDQ?e=WdXSuk

 

Doing some work on calculating Inventory Turnover Days. I am successfully able to calculate the Inventory Turnover Days as seen in the visual monthly and quarterly:

 

Fraze_0-1644510533795.png

 

 

Fraze_1-1644510533746.png

 

 

However, I cannot seem to create a measure that calcualtes the 3 month moving average. How would I convert my current measure, or create a new one that would give me the moving average?

 

Using using DATESINPERIOD from this ARTICLE I attempted to create the moving average is was looking for, but is not working since the end result is the same...

 

Fraze_2-1644510644077.png

Any help and direction would be appreaciated. Thanks!

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Fraze 

 

Can you show the mathematical formula if you calculate the 3 month moving average by hand? Currently since your measure could not give the correct result, I'm not sure what is the logic to calculate the result you want. You can take the latest month in this sample as an example. This would help us understand the logic better. 

 

Best Regards,
Community Support Team _ Jing

DataInsights
Super User
Super User

@Fraze,

 

Your data model needs a date table in order to use time intelligence functions. After adding a date table, create a relationship between the two tables, and modify your measure to use the date table (not the date column in the fact table).

 

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/ 





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

Proud to be a Super User!




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.