Forum Discussion

vidyasagar159's avatar
vidyasagar159
Icon for Helper II rankHelper II
6 years ago
Solved

Cumulative total minus another column

Hi All,

 

Its an enhancement to my earlier request. But not able to crack the logic. Please help.

 

I simply want to do subtraction of CumulativeTotal - AnotherColumn based on the product category filter. Here is the sample data with some expected outputs.

 

I was able to achieve the Green Column. But I am stuck on achieving the Yellow column.

 

Sample data:

 

ProductCategoryAmount_OneAmount_TwoAmount_ThreeCumulative of Amount_TwoCalculated Column 1 = IF(Table1[Category] = “Red”, [Amount_One]-[Amount_Two], [Amount_One]-[Amount_Three]]Calculated Column 2 = IF(Table1[Category] = “Red”, [Amount_One]-Cumulative of Amount_Two, [Amount_One]-[Amount_Three]]
ARed1001090109090
ARed200208030180170
ARed300307060270240
ARed4004060100360300
ARed5005050150450350
ARed6006040210540390
BBlack7007030280670420
BBlack8008020360780440
BBlack9009010450890450
BBlack100010005501000450
BBlack1100110-106601110440
BBlack1200120-207801220420

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi @vidyasagar159 ,

     

    I’m not sure whether the logic of calculated column 2 or the outputs in your sample data is what you want.

    In that case I created two calculated columns as below:

    Calculated Column 2 = IF('Table'[Category] = "Red", [Amount_One]-'Table'[Cumulative of Amount_Two], [Amount_One]-[Amount_Three])

    Calculated Column 3 = [Amount_One]-'Table'[Cumulative of Amount_Two]

    And the result would be shown as below:

    If I misunderstood your meaning, please let me know.

    BTW, Pbix as attached, hopefully works for you.

     

    Best Regards,

    Jay

    Community Support Team _ Jay Wang

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