Forum Discussion

Michieldo's avatar
Michieldo
Helper III
4 years ago
Solved

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: Date In-sample Forecast 1-1-2022 100 null 1-2-2022 120 null 1-3-2022 120 ...
  • v-chenwuz-msft's avatar
    v-chenwuz-msft
    4 years ago

    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 

     


    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.