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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
szymakat
New Member

Get last available value from previous dates if it's empty

Hello, 
would anyone have an idea how to fetch lastest available value if for certain date is null? 
I'd need to repeat 476.62 for days with no result. 
If on some point it changes to 500 and next days have nulls - i want to populate 500 then, up till today. 

Thanks so much for your time!

szymakat_0-1752668276049.png

 

1 ACCEPTED SOLUTION
v-tejrama
Community Support
Community Support

Hi @szymakat ,

Thanks for reaching out to the Microsoft fabric community forum.

 

You can efficiently address the issue of filling null values in Power BI by using DAX. Suppose your table includes date_c, project, and scope_km columns, and some scope_km values are blank. To forward-fill the last known value until a new one appears, follow these steps:

Start by entering your data in Power BI, including sample dates, project names (e.g., UNY_NYC_Manhattan), and scope_km values such as 476.62 and 500, with blanks in between. After loading the data, switch to “Data” view and create a new column with this DAX formula:


ValueWithPrevious =
VAR CurrentDate = ProjectData[date_c]
VAR CurrentProject = ProjectData[project]
RETURN
CALCULATE(
   MAX(ProjectData[scope_km]),
   FILTER(
       ProjectData,
       ProjectData[project] = CurrentProject &&
       ProjectData[date_c] <= CurrentDate &&
       NOT(ISBLANK(ProjectData[scope_km]))
   )
)

 

This formula dynamically retrieves the most recent non-blank value for each project up to the current date. After creating the column, add date_c, project, scope_km, and the new ValueWithPrevious column to your table visual. This method ensures all nulls are accurately forward-filled.

 

Please find the attached pbix and screenshort file for your reference.

 

vtejrama_0-1752742635694.png

 

 

Best Regards,
Tejaswi.
Community Support

 

 

View solution in original post

3 REPLIES 3
v-tejrama
Community Support
Community Support

Hi @szymakat ,

Thanks for reaching out to the Microsoft fabric community forum.

 

You can efficiently address the issue of filling null values in Power BI by using DAX. Suppose your table includes date_c, project, and scope_km columns, and some scope_km values are blank. To forward-fill the last known value until a new one appears, follow these steps:

Start by entering your data in Power BI, including sample dates, project names (e.g., UNY_NYC_Manhattan), and scope_km values such as 476.62 and 500, with blanks in between. After loading the data, switch to “Data” view and create a new column with this DAX formula:


ValueWithPrevious =
VAR CurrentDate = ProjectData[date_c]
VAR CurrentProject = ProjectData[project]
RETURN
CALCULATE(
   MAX(ProjectData[scope_km]),
   FILTER(
       ProjectData,
       ProjectData[project] = CurrentProject &&
       ProjectData[date_c] <= CurrentDate &&
       NOT(ISBLANK(ProjectData[scope_km]))
   )
)

 

This formula dynamically retrieves the most recent non-blank value for each project up to the current date. After creating the column, add date_c, project, scope_km, and the new ValueWithPrevious column to your table visual. This method ensures all nulls are accurately forward-filled.

 

Please find the attached pbix and screenshort file for your reference.

 

vtejrama_0-1752742635694.png

 

 

Best Regards,
Tejaswi.
Community Support

 

 

This works perfectly! Thank you so much for your effort.

FBergamaschi
Solution Sage
Solution Sage

Please include, in a usable format, not an image, a small set of rows for each of the tables involved in your request and show the data model in a picture, so that we can import the tables in Power BI and reproduce the data model. The subset of rows you provide, even is just a subset of the original tables, must cover your issue or question completely. Do not include sensitive information and do not include anything that is unrelated to the issue or question. 

 

Need help uploading data? click here

 

Want faster answers? click here

 

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.