Forum Discussion

dodiyal's avatar
dodiyal
Frequent Visitor
4 years ago
Solved

Subtracting values in same column until the value becomes 0

Hello Team,

 

I have a data set where i have to subtract value untill its zero can you please help me. I need dax to solve-

Please see the data

week      sale

Week1    10

week2     5

week3     5

Total    20

So here the toal sale is 20 and i need the resuls like this

Week    Sale

Week1    10  (20-10)

Week2     5  (10-5)

Week3    0    (5-0)

 

Appreciate your help please

5 Replies

  • Hi,

    I am not sure if I understood correctly your question, but I tried to create a sample pbix file like below.

    Please check the below picture and the attached pbix file whether it suits your requirement.

    I hope the below can provide some ideas on how to create a solution for your dataset.

     

     

    Expected measure: = 
    CALCULATE ( [Sales total:], REMOVEFILTERS () )
        - CALCULATE ( [Sales total:], Data[Week] <= MAX ( Data[Week] ) )
    

     

  • dodiyal's avatar
    dodiyal
    Frequent Visitor

    hi jihwan,

    thank you for quick reply. i checked but still it is showing high values instead of burn down till zero, pleaserefer the data i worked on, can you please look into thisd and advise.

     

    Appreciate your help.

     

     

       
       
       
       
       
       
    WEEK REVISED SPDweekin numberssale
    36-2220223625
    37-2220223717
    38-2220223822
    39-222022398
    40-2220224016
    41-222022413
    42-222022425
    43-2220224310
    44-222022442
    45-222022452
    46-222022463
    47-222022473
    48-222022482
    49-222022496
    50-222022502
    51-222022516
    52-222022523
    53-222022531
    01-232023012
    02-232023021
    03-232023032
    05-232023055
    06-232023062
    07-232023074
    08-232023085
    12-232023124
    13-232023131
    14-232023141
    15-232023151
    17-232023171
    22-232023221