Forum Discussion

dodiyal's avatar
dodiyal
Frequent Visitor
3 years ago
Solved

Subtracting values in same column until the value becomes 0

Hello Team,   I have 2 datasets where the- -first dataset is for customer grop,week number and no.of lines being delivered to customer. -Second dataset is only customer group   Now i wish to do...
  • Greg_Deckler's avatar
    3 years ago

    dodiyal I did it this way. PBIX is attached below signature.

    Burndown = 
        VAR __Week = MAX('Data 1'[week number graph])
        VAR __Customers = DISTINCT(SELECTCOLUMNS('Data 2',"__Customer",[Customer Group]))
        VAR __Table = FILTER(ALL('Data 1'),'Data 1'[Customer Group] IN __Customers && [week number graph] <= __Week)
        VAR __Total = SUMX(FILTER(ALL('Data 1'),'Data 1'[Customer Group] IN __Customers),[No. of Lines])
        VAR __SoFar = SUMX(__Table,[No. of Lines])
        VAR __Result = MAX(__Total - __SoFar, 0)
    RETURN
        __Result