Forum Discussion

brunomoriya's avatar
brunomoriya
Helper I
8 years ago
Solved

Repeat last date for each row

Hello everyone,   As you can see, i need a calculated column, that repeats the last date whenever the value between "Total Left" and "Amount Left Day Before" doesnt change, and if i get a differenc...
  • Zubair_Muhammad's avatar
    Zubair_Muhammad
    8 years ago

    brunomoriya

     

    here is a dax calculated column

     

    Column =
    VAR Dif = Table1[Total Left] - Table1[Amount Left Day Before]
    VAR previousrow =
        TOPN (
            1,
            FILTER (
                Table1,
                Table1[Product] = EARLIER ( Table1[Product] )
                    && Table1[Date] < EARLIER ( Table1[Date] )
                    && ( Table1[Total Left] - Table1[Amount Left Day Before] )
                    <> 0
            ),
            [Date], DESC
        )
    RETURN
        IF ( Dif = 0, MINX ( previousrow, [Date] ), Table1[Date] )