Forum Discussion

rawiswarden's avatar
rawiswarden
Icon for Helper I rankHelper I
6 years ago
Solved

Cumulative Loss Curves

Hello,   I am trying to do a calculation in Power BI but I am unsure how to structure it.     I need to calculate conditional cumulative losses and balances over time.  The X axis is months since...
  • v-lili6-msft's avatar
    6 years ago

    hi rawiswarden 

    You could use this formula to create a new table as below:

    New Table = 
    ADDCOLUMNS (
        SELECTCOLUMNS ( 'Table', "Time Period", 3 * 'Table'[ID] ),
        "Balance", CALCULATE (
            SUM ( 'Table'[Balance] ),
            FILTER ( 'Table', 'Table'[Age] >= [Time Period] )
        ),
        "Cumulative Loss", CALCULATE (
            SUM ( 'Table'[Loss] ),
            FILTER (
                'Table',
                'Table'[Age] >= [Time Period]
                    && 'Table'[Duration] <= [Time Period]
            )
        )
    )

    and then add a calculated column as below:

    Percent = 'New Table'[Cumulative Loss]/'New Table'[Balance]

    Result:

     

    and here is sample pbix file, please try it.

     

    Regards,

    Lin