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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
niko18033
Helper I
Helper I

Formula to return value corresponding to latest date

Hi Folks - I'd appreciate some help tackling this issue. Basically, I'd like to "fix" a measure based upon the result of a different measure, corresponding to the latest date in the date column (which would be today since this is refreshed daily).

 

I've tried a myriad of approaches, including lastdate(date), max(date), today(), but none have worked. I was able to fix it on the most recent date (see below), but this is not dynamic and will change when the data is refreshed.

 

10 week mean = CALCULATE(
        [10 week rolling avg],
        'FA Counts'[CREATEDATE] IN { DATE(2019, 5, 13) } )
 
Basically I need to use this custom rolling average function, but just for the latest week. I'm using this for a subset of the standard deviation formula (x-mu)^2, where Mu in this example must be 68.1.
 
I need the standard deviation forumula to read each row's count individually (x) but subtract it from the fixed mean of 68.1, since that is the last 10 wk average. The preceding rolling averages are not relevant.

 

DateCount10 week rolling avg10 week mean
3/4/2019608.868.1
3/11/20197914.868.1
3/18/20195322.768.1
3/25/2019662868.1
4/1/20198034.668.1
4/8/20198342.668.1
4/15/20195250.968.1
4/22/20196856.168.1
4/29/20196462.968.1
5/6/20197665.368.1
5/13/20197768.168.1

 

Any help would be much appreciated!

1 REPLY 1
parry2k
Super User
Super User

@niko18033 try this measure

 

10 Week Mean1 = 
VAR __mostRecentDate = CALCULATE( MAX( Table3[Date] ), ALL( Table3[Date] ) )
RETURN 
CALCULATE( [10 week rolling avg],Table3[Date] = __mostRecentDate )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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