Forum Discussion

kumsha1's avatar
kumsha1
Post Patron
5 years ago
Solved

Fill down the column values with a calculated column

Hi,   Can someone please help with the DAX to fill down the values for TONNES_LINE, so the 0 will be replaced by the actual value...it's required in a calculated column. Thanks !          
  • v-janeyg-msft's avatar
    5 years ago

    Hi, kumsha1 

     

    It’s my pleasure to answer for you.

    According to your description, I think you can create a measure to calculate the correct result.

    Like this:

     

    Measure =
    IF (
        SELECTEDVALUE ( Table1[TONNES_LINE] ) = 0,
        VAR a =
            MAXX (
                FILTER (
                    ALL ( Table1 ),
                    [Index] < SELECTEDVALUE ( Table1[Index] )
                        && Table1[TONNES_LINE] <> 0
                ),
                [Index]
            )
        RETURN
            MAXX ( FILTER ( ALL ( Table1 ), Table1[Index] = a ), Table1[TONNES_LINE] ),
        SELECTEDVALUE ( Table1[TONNES_LINE] )
    )

     

    If it doesn’t solve your problem, please feel free to ask me.

     

    Best Regards

    Janey Guo

     

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