Forum Discussion

jludwick's avatar
jludwick
Frequent Visitor
2 years ago
Solved

Change DAX calculated column using EARLIER Function

Hello,   I recently read that you should not use the EARLIER function. I recently inherited a dataset file that uses this function and it keeps crashing, likely due to the EARLIER function. I am tr...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi jludwick ,

     

    If you want to create a calculated column, you can try:

    _Balance Cumulative =
    var _a=Invoices[Invoice Date]
    return
    calculate(sum(Invoices[Balance]),
              ALLEXCEPT(Invoices,Invoices[Customer ID + Company Desc]),
              filter(
                 all(Invoices[Invoice Date]),Invoices[Invoice Date] <= _a
                     ))

    If you want to create a measure, you can try:

     

    _Balance Cumulative =
    calculate(sum(Invoices[Balance]),
              ALLEXCEPT(Invoices,Invoices[Customer ID + Company Desc]),
              filter(
                 all(Invoices[Invoice Date]),Invoices[Invoice Date] <= 
                     MAX(Invoices[Invoice Date])))

     

    Best Regards,

    Neeko Tang

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