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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Woodyy
Regular Visitor

Need help with YTD moving average

Hi everybody, 

 

I am trying to compute the YTD moving average for the product A for 2023 and 2024. The date is in the same column both for 2023 and 2024 and 
I would like to eventually obtain a YTD column where it starts the average computation again from 0 in january 2024, without taking into account also the 2023 values( as it instead does in the rapid measure)

 

How can i solve it?

thank you!!! 

1 ACCEPTED SOLUTION

Hello, @Woodyy ,
as long as you have Date type in one of the columns in your calendar (with relationship to your fact table) and you use that calendar inside the expressions, it's going to work just fine.

 

Please test and mark the right answer as a solution, possibly some kudos would be also appreciated. Thank you

View solution in original post

7 REPLIES 7
vojtechsima
Resident Rockstar
Resident Rockstar

Hello, @Woodyy ,
you can try using TOTALYTD.

Measure = TOTALYTD(<your expression>, 'Calendar'[Date]) 
-- make sure you have valid Calendar for this.

Dear @vojtechsima , thank you for the reply! 
How do I compute the moving average in this case ? 

@Woodyy 

vojtechsima_0-1730748714282.png

avg = AVERAGE('Table'[value])
avgRunning = TOTALYTD([avg], 'calendar'[Date])


given you have the calendar

 

Thank you so much @vojtechsima , it is very clear now! 
i have a date column ( in the date format) with years and months. Does it work anyway or do I need to change it to the right format? And if yes, how can I do it? 
thank you again! 

Thank you so much @vojtechsima, it is very clear! 
I have a column with the date ( in the date format) with years and months. Does it work anyway or do i need to create another column in that specific way? And, in case , how can I convert my date column in the right format? 

thank you again! 

Hello, @Woodyy ,
as long as you have Date type in one of the columns in your calendar (with relationship to your fact table) and you use that calendar inside the expressions, it's going to work just fine.

 

Please test and mark the right answer as a solution, possibly some kudos would be also appreciated. Thank you

Dear @vojtechsima , thank you again! 
i have tried your solution but unfortunately it does not work because I forgot to mention that I would compute the average of a measure( this measure simply computes the rate between two values) and the AVERAGE function does not recognizes the measures. 
How can i fix it? 

thank you so much!!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.