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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
CVance
Frequent Visitor

Getting a value for a single date from X days ago

My data has gaps in the date field (non-consecutive dates).

I need a rate value for a single date from X days ago (30, 60 ...), and if the date X days ago has no value (that day is missing in the data table), then I need to back up in time until I find a value. How do I find it?

My thoughts are to create a temp table consisting of Calendar[Date], 'Rate Index'[Name], 'Rate Data'[Date], 'Rate Data'[Value], then filter the table by a timeframe (startdate: today-X-20, enddate: today-X), then use LastNonBlankValue to get the latest non-blank value.

The startdate and enddate I have as measures (windowStartDate, windowEndDate), and I have a temp table of values, but I'm having trouble getting it all together. Plus, my table has no blank rows for calendar dates with no rate data, but I think that's ok for this function.

I may be waaaay off in my thinking as I'm pretty new to DAX.

For the test data below, assume the user has selected 7/25/2010 as the date to retrieve the rate value. Since 7/25 is not a row in the table, the correct answer would be 1.5% from 7/22/2010.

Thanks in advance for any ideas!

 

NameAs of DateRate Value
Treasury 1 Month7/16/20101.20%
Treasury 1 Month7/19/20101.30%
Treasury 1 Month7/20/20101.40%
Treasury 1 Month7/22/20101.50%
Treasury 1 Month7/27/20101.60%
Treasury 1 Month7/28/20101.70%
Treasury 1 Month7/30/20101.80%
Treasury 1 Month8/3/20101.90%
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1725687509096.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

PBI file attached.

Hope this helps.

Ashish_Mathur_0-1725687509096.png

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

since these rates are immutable this can be done with a caclulated column in your Calendar table.

 

lbendlin_0-1725663447963.png

 

Thank you for this solution. It does work, but I've decided not to create a calculated column for my report.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors