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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
FLHound
Frequent Visitor

Need to return single date for each year for rolling average measure

Hi everyone, 

I'm looking to calculate a rolling average, but first I need the date in which it will calculate over. My dataset currently contains 19 years worth of information, each identified with a "Season" (ex: 2021, 2022, etc). I need to identify the last date ("date_closed") of each season. 

So far, I've tried some measures combining MAX(date_closed) & FILTER for "Season", but I haven't gotten what I want

 

I get my result in Excel, but I'm not too versed in DAX yet. Any help is appreciated 

1 ACCEPTED SOLUTION

@FLHound 

is this what you want?

Column = CALCULATE(max('Table'[date]),ALLEXCEPT('Table','Table'[season]))

1.PNG





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

Proud to be a Super User!




View solution in original post

5 REPLIES 5
ryan_mayu
Super User
Super User

@FLHound 

could you pls provide the sample data and the expected output?





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

Proud to be a Super User!




@ryan_mayu I can't provide the sample data, but maybe I can clarify a bit more.

 

Each row of my data is assigned a "season" (a year) and I would eventually like to calculate a rolling average over the "seasons". However, I need to use the final data for each season, which is associated with a particular date - the MAX of "date_closed". Final data is the accumulation of all data up until the latest date in each season. 

 

Expected result: 

If the MAX date of "Season" 2020 is 4/1/2020, all rows with 2020 as the season must show 4/1/2020 as the final date (in a column)

 

@FLHound 

is this what you want?

Column = CALCULATE(max('Table'[date]),ALLEXCEPT('Table','Table'[season]))

1.PNG





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

Proud to be a Super User!




Yes, I believe this will work! The result is exactly what I'm aiming for. Thank you so much. 

you are welcome





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

Proud to be a Super User!




Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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