Forum Discussion

jnw221's avatar
jnw221
Frequent Visitor
3 years ago
Solved

Sum of two values + another

I'm trying to get the cumulative total of the original loan balance plus interest. In excel, the output would look like this:   Loan Balance Rate Days Interest Due Cumulative Interest Cumul...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi jnw221 ,

    Please have a try.

    Create 2 columns.

    cumulative total column = 
    var _minindex=MINX(('Table'),'Table'[Index])
    var _re=CALCULATE(SUM('Table'[Cumulative Interest]),FILTER('Table','Table'[Index]<>_minindex&&'Table'[Index]<=EARLIER('Table'[Index])))
    var _1re=IF('Table'[Index]=_minindex,'Table'[Loan Balance]+'Table'[Cumulative Interest],BLANK())
    var _cumu=MAXX('Table',_1re)
    return _cumu
    Column = var _1= MAXX('Table','Table'[cumulative total column])
    var _minindex=MINX(('Table'),'Table'[Index])
    var _2=CALCULATE(SUM('Table'[Cumulative Interest]),FILTER('Table','Table'[Index]<>_minindex&&'Table'[Index]<=EARLIER('Table'[Index])))
    return
    IF('Table'[Index]=_minindex,'Table'[cumulative total column],_1+_2)

    Then create a measure or a column.

    Measure = var _next=CALCULATE(MAX('Table'[Column]),FILTER(ALL('Table'),'Table'[Index]=SELECTEDVALUE('Table'[Index])+1))
    return 
    _next
    Column 2 = var _next=CALCULATE(MAX('Table'[Column]),FILTER(ALL('Table'),'Table'[Index]=EARLIER('Table'[Index])+1))
    return 
    _next

     

     

    If I have misunderstood your meaning, please provide more details with the desired output and pbix file without privacy information.

     

    Best Regards

    Community Support Team _ Polly

     

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