Forum Discussion

cah2035's avatar
cah2035
Frequent Visitor
3 years ago
Solved

For a null value, check if the value above and below are equal and if so, fill in the null value

Hi all,   I have to fill in dates for a huge number of rows. Most of the dates I was able to match with another table, for a decent amount, I was not. My records are in a particular order (essentia...
  • BA_Pete's avatar
    3 years ago

    cah2035 ,

     

    You could try this. Not sure how performant it will be over a large dataset, but should do what you need:

    -1- Add index starting from zero (called [IndexFrom0]).

    -2- Add new custom column like this:

     

    if [Date] = null
        and PreviousStepName[Date]{[IndexFrom0] - 1} = PreviousStepName[Date]{[IndexFrom0] + 1}
        and PreviousStepName[Category]{[IndexFrom0] - 1} = PreviousStepName[Category]{[IndexFrom0] + 1}
    then PreviousStepName[Date]{[IndexFrom0] - 1}
    else [Date]

     

    Example output:

     

    Pete