Forum Discussion

Omelei's avatar
Omelei
Frequent Visitor
3 years ago
Solved

Create new column with previous ID

Hi    I've created the following table.    Account ID Opp ID Previous Opp ID Startdate Revenue Custom Previous Opportunity ID 100000 006AAA 006AAB 1-1-2023  € 250.000   100000 ...
  • FreemanZ's avatar
    3 years ago

    hi Omelei 

     

    try to add the column with this:

    Custom Previous Opportunity ID 2 = 
    VAR _id = [Account ID]
    VAR _date = [Startdate]
    VAR _table =
    FILTER(
        data,
        data[Account ID] = _id
    )
    VAR _date1=
    MAXX(
        FILTER(
            _table,
             data[Startdate]<_date
        ),
        data[Startdate]
    )
    RETURN
    MAXX(
        FILTER(
           _table,
            data[Startdate] = _date1
        ),
        data[Opp ID]
    )

     

    it shall work like this: