Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Help with circular reference calculation

Hello,    I need to perform a difficult calculation on my model and I can not seem to find the answer to this.   The context is:   Every month I have a total cost, but I have a limit on how muc...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous 

     

    What are your original columns? I got Month, Cost, Limit only, then 3 Calculated columns

    Difference = 
    VAR CurMonth = 'Table'[Month]
    VAR T1=FILTER('Table','Table'[Month]<=CurMonth)
    RETURN
    SUMX(T1,[Cost]-[Limit])
    
    Previous Month = 
    MAXX(FILTER('Table','Table'[Month]=EDATE( EARLIER('Table'[Month]),-1)),[Difference])
    
    Total = [Cost]+[Previous Month]