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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Michieldo
Helper III
Helper III

Fill up only one row

Hi,

I have a column with in-sample data and a column with forecasts. The table is formatted as follows:

DateIn-sampleForecast
1-1-2022100null
1-2-2022120null
1-3-2022120null
1-4-2022null130
1-5-2022null130 


I would like the fill up the forecast only by 1 row. My desired result is the following:

DateIn-sampleForecast
1-1-2022100null
1-2-2022120null
1-3-2022120130
1-4-2022null130
1-5-2022null130 

What is the most efficient way in Power Query?

1 ACCEPTED SOLUTION

Hi @Michieldo ,

 

You can try edit the code for if the next row is null and the current row is not null then get the next row's forecast else your forecast expression. Before this, add an index column firstly.

if #"Added Index"{[Index]+1} [In-sample] = null & [In-sample] <> null then #"Added Index"{[Index]+1} [Forecast] else [Forecast]

About how to get the next row values ,you can refer this article.

https://www.myonlinetraininghub.com/referencing-next-row-power-query 

vchenwuzmsft_0-1644462749291.png

 


Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
ToddChitt
Super User
Super User

What is your back-end data source? If it is SQL, your GROUP BY in Power Query *may* get pushed down into the native T-SQL statement that Power Query issues to the server. If so, such grouping is done by SQL instead of the Power BI mashup engine. Pretty nice. If you are not sure, investigat the topic of "Query folding in Power Query".




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





ToddChitt
Super User
Super User

Seems the steps would be:

Filter the data for NULL Forecast, then aggragate to get the max date. Seems simple, what am I missing?




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





@ToddChitt Thanks for your reply, that is indeed a possibility. However, I forgot to mention that I have to do this for over a set of 10000 products (>1M rows) so I was looking for a less memory intensive method.

Hi @Michieldo ,

 

You can try edit the code for if the next row is null and the current row is not null then get the next row's forecast else your forecast expression. Before this, add an index column firstly.

if #"Added Index"{[Index]+1} [In-sample] = null & [In-sample] <> null then #"Added Index"{[Index]+1} [Forecast] else [Forecast]

About how to get the next row values ,you can refer this article.

https://www.myonlinetraininghub.com/referencing-next-row-power-query 

vchenwuzmsft_0-1644462749291.png

 


Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Kudoed Authors