Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

running total

I am having issues creating a running total on the field "Count Charged off loans" with the output the way it is in the green column. (the running total resets when the tier field changes). Please i need help

  • parry2k's avatar
    parry2k
    7 years ago

    use this measure 

     

    RT = CALCULATE( SUM( Table1[Count Charged off Loans] ), 
    FILTER( ALLEXCEPT( Table1, Table1[Tier] ), Table1[Loan Life] <= MAX( Table1[Loan Life] ) ))
  • Anonymous's avatar
    Anonymous
    7 years ago

    Anonymous,

    You can also use the following DAX to calculate the measure.

    Expected result = 
        CALCULATE (
            SUM ( Table1[Count Charged off Loans] ),
            FILTER (
                ALL ( Table1 ),
                Table1[Loan Life] <=MAX(Table1[Loan Life])
            ),VALUES(Table1[Tier])
        )



    Regards,
    Lydia

9 Replies

  • Hi Anonymous

     

    could you post a dataset which can be copied/pasted? Also do you want to do this in a measure or calculated column?

  • You can create a calculated column like this:

    Count Charged off loans RT =
    VAR CurrentTier = Table[Tier]
    VAR CurrentLoanLife = Table[Loan Life]
    RETURN
        CALCULATE (
            SUM ( Table[Count Charged off Loans] ),
            FILTER (
                ALL ( Table ),
                Table[Tier] = CurrentTier
                    && Table[Loan Life] <= CurrentLoanLife
            )
        )
    • Anonymous's avatar
      Anonymous
      Not applicable

      I would like it as a measure and not a calculated column cos the end game is to use it on a graph

      • parry2k's avatar
        parry2k
        Super User

        use this measure 

         

        RT = CALCULATE( SUM( Table1[Count Charged off Loans] ), 
        FILTER( ALLEXCEPT( Table1, Table1[Tier] ), Table1[Loan Life] <= MAX( Table1[Loan Life] ) ))
  • Anonymous's avatar
    Anonymous
    Not applicable
    TierCount Booked LoansLoan LifeCount Charged off LoansExpected Result
    623000
    623911
    6231723
    6231914
    6232015
    6232116
    62322410
    62325212
    823000
    823211
    8231634
    82322610

     

    I actually want it as a calculated measure

    • Anonymous's avatar
      Anonymous
      Not applicable

      Anonymous,

      You can also use the following DAX to calculate the measure.

      Expected result = 
          CALCULATE (
              SUM ( Table1[Count Charged off Loans] ),
              FILTER (
                  ALL ( Table1 ),
                  Table1[Loan Life] <=MAX(Table1[Loan Life])
              ),VALUES(Table1[Tier])
          )



      Regards,
      Lydia