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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Antmkjr
Post Patron
Post Patron

Dynamically find the nearest non-blank value in Sameperiod last year

I have data as shown below:

Expected o/p is nearest non-blank value in the same period last year. If for Sameperiod last year Value is not available,  returns a blank, it should search both before and after that month (expanding outward month-by-month) for until a closest non-blank is found

Date ValueExpected o/p
29/12/2023800 
15/02/202450 
28/04/202440 
08/04/202480 
07/01/202590800
08/01/202550800
13/01/2025900800
10/02/20256050
28/02/20258050
17/03/202515050
15/04/202510080
1 ACCEPTED SOLUTION

5 REPLIES 5
lbendlin
Super User
Super User

SAMEPERIODLASTYEAR for a single value is ambiguous. Please be more specific. Do you mean "prior year" ?

 

lbendlin_0-1744748173874.png

or like this

lbendlin_2-1744748709304.png

 

 

Spot On! Just that total is incorrect.

Which one is spot on? For the total to be correct you can wrap the code in an aggregation.

First one, but is it not already wrapped in aggregation.?

lbendlin_0-1744908439967.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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