Forum Discussion

mdjlambeens's avatar
mdjlambeens
Frequent Visitor
9 years ago
Solved

Getting the next date/time from the same column

Hello! I am working with a SalesForce database and have run into a problem. What I want to acquire is the next Created Date of an opportunity so I can measure the time between different entries an...
  • v-jiascu-msft's avatar
    v-jiascu-msft
    9 years ago

    Hello, mdjlambeens,

     

     

    It seems that you really have a big table. Due to FILTER generate a n*n calculation, we should avoid it. Here may be the solution. It worked. You can have a try.
    1. Open query editor. Sorted by "OpportunityId";
    2. Open ADVANCED EDITOR (Sign 2), then add ", {"CreatedDate", Order.Ascending}" (sign 3).
    3. Click DONE, you will see two sorted arrows (in yellow square).This is what we want.
    4. Add index.
    5. Add a calculated column with this formula.

    Next CreatedDatevar =
    VAR CurrentIndex = 'Opportunity History'[IndexNew]
    RETURN
        CALCULATE (
            MIN ( 'Opportunity History'[CreatedDate] ),
            ALLEXCEPT ( 'Opportunity History', 'Opportunity History'[OpportunityId] ),
            'Opportunity History'[Indexnew]
                = currentindex + 1
        )