Forum Discussion

Richard_Clipsto's avatar
Richard_Clipsto
Frequent Visitor
1 year ago
Solved

Help with a Calculated Column

Hi, I have a table which looks a bit like this:   Unit Amendment Type Final Rent Start Date End Date A Original Lease £100 01/01/2020 31/12/2023 A Termination     31/12/2023...
  • Bibiano_Geraldo's avatar
    1 year ago

    Hi Richard_Clipsto , Please try the following Dax code to create the calculated column:

    PreviousFinalRent = 
    VAR CurrentUnit = Table[Unit]
    VAR CurrentStartDate = Table[Start Date]
    RETURN 
        CALCULATE(
            MAX(Table[Final Rent]),
            FILTER(
                Table,
                Table[Unit] = CurrentUnit &&
                Table[Amendment Type] IN {"Original Lease", "Renewal"} &&
                Table[Start Date] < CurrentStartDate
            )
        )