Forum Discussion

Zoran05's avatar
Zoran05
Frequent Visitor
2 years ago
Solved

Previous latest available Date

Hi community,    I'm using the following formula to get the previous Day Price. The problem is that on a weekend or holiday I don't have a price. So on a Monday the calculation returns no value.  ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Zoran05 

    You can try the follwing measure.

    Sample table.

    Prev Day Price =
    VAR a =
        MAXX (
            FILTER (
                ALLSELECTED ( 'Date Lookup'[Datum] ),
                [Datum] < MAX ( 'Date Lookup'[Datum] )
                    && [Current Price] <> BLANK ()
            ),
            [Datum]
        )
    RETURN
        IF (
            [Current Price] <> BLANK (),
            CALCULATE ( [Current Price], 'Date Lookup'[Datum] = a )
        )
    

    Output

     

     

     

    Best Regards!

    Yolo Zhu

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