Forum Discussion

Santanak's avatar
Santanak
Regular Visitor
4 years ago
Solved

Roll over

Hi All,

 

Need help in below calculation as i am new to PBI.

 

C= B - 15000

D = d[n-1] + c[n]

 

  A              B               C                   D

monthDemandDemand - 15000Carry forward
Jan273421234212342
Feb7025-79754367
Mar305841558419951
Apr22044704426995
June11711-328923706
July261031110334809
Aug1526626635075
  • Hi Santanak 

     

    I assume that your month column is based on a date column add the following two measures:

     

    v

    Demand -15000 = SUM('Table'[Demand]) -15000
    
    Carry forward =
    SUMX (
        CALCULATETABLE (
            SUMMARIZE ( 'Table', 'Table'[month], "@Demand-15000", [Demand -15000] ),
            'Table'[month] <= MAX ( 'Table'[month] )
        ),
        [@Demand-15000]
    )

     

4 Replies

  • Hi Santanak 

     

    I assume that your month column is based on a date column add the following two measures:

     

    v

    Demand -15000 = SUM('Table'[Demand]) -15000
    
    Carry forward =
    SUMX (
        CALCULATETABLE (
            SUMMARIZE ( 'Table', 'Table'[month], "@Demand-15000", [Demand -15000] ),
            'Table'[month] <= MAX ( 'Table'[month] )
        ),
        [@Demand-15000]
    )

     

    • Santanak's avatar
      Santanak
      Regular Visitor

      Thanks Felix for the solution. Just one more criteria, if carried forward is negative in previous row then it will not add.

      • MFelix's avatar
        MFelix
        Super User

        Hi Santanak,

         

        You want that if for example you have

         

         

        Demand -15000 Carried Forward Carried forward Expected
        1000 1000 1000
        -1500 -500 1000
        500 0 1500

         

        Is this what you mean?