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 a burn down chart in data set 1 which will vary if we select any customer from dataset 2 is slected (without connecting the files).

 

Please see below as an example what i need your help on-

 

Suppose i selcted Qatar in dataset 2 then burn down in chart 1 should Subtracting number of lines in same column until the value becomes 0 only for Qatar.

In this example there are 167 total lines for Qatar

 

 

So WK5  will show 167-25=142

And it goes on till the value becomes 0

 

 

If no selcection in data set 2 is made then sum should be all.

 

So WK 5 will show

WK5- 308-95=213

and goes on till the value becomes 0

 

I could create the dax but it is not correct, i find the data or your review.

 

 

 

 

Please help

 

 

data 1

 

Customer Groupweek numberNo. of Linesweek number graph
9 AIR CO., LTD.20230535
AAR ALLEN AIRCRAFT202305195
AAR ENGINEERING SERVICES-ASIA20230515
AEGEAN AIRLINES20230525
CEBU Air, Inc202305335
QANTASLINK202305125
QATAR AIRWAYS202305255
AAR ALLEN AIRCRAFT20230616
CEBU Air, Inc20230626
QATAR AIRWAYS20230696
AEGEAN AIRLINES20230727
CEBU Air, Inc20230737
QANTASLINK20230717
QATAR AIRWAYS202307137
AAR ALLEN AIRCRAFT20230838
AEGEAN AIRLINES20230828
CEBU Air, Inc20230828
QATAR AIRWAYS202308218
AEGEAN AIRLINES20230929
CEBU Air, Inc20230919
QANTASLINK20230919
QATAR AIRWAYS202309129
AAR ALLEN AIRCRAFT202310210
AEGEAN AIRLINES202310110
CEBU Air, Inc2023101410
QANTASLINK202310110
QATAR AIRWAYS202310810
AEGEAN AIRLINES202311711
CEBU Air, Inc202311111
QANTASLINK202311311
QATAR AIRWAYS202311711
AEGEAN AIRLINES202312212
AER LINGUS202312112
CEBU Air, Inc202312112
QATAR AIRWAYS202312212
AAR ALLEN AIRCRAFT202313113
AEGEAN AIRLINES202313213
AER LINGUS202313113
CEBU Air, Inc202313213
QANTASLINK202313113
QATAR AIRWAYS2023131013
QANTASLINK202314114
QATAR AIRWAYS202314814
CEBU Air, Inc202315115
QATAR AIRWAYS202315615
AEGEAN AIRLINES202316516
CEBU Air, Inc202316116
QANTASLINK202316116
QATAR AIRWAYS202316216
CEBU Air, Inc202317117
QATAR AIRWAYS202317817
QATAR AIRWAYS2023181118
AEGEAN AIRLINES202319119
QATAR AIRWAYS2023191119
QATAR AIRWAYS202320120
QATAR AIRWAYS202321221
QATAR AIRWAYS202322122
QATAR AIRWAYS202323323
QATAR AIRWAYS202324124
QATAR AIRWAYS202325125
QATAR AIRWAYS202326226
QATAR AIRWAYS202327127
QATAR AIRWAYS202330130
QATAR AIRWAYS202334134

 

 

data 2

Customer Group
9 AIR CO., LTD.
AAR ALLEN AIRCRAFT
AAR ENGINEERING SERVICES-ASIA
AEGEAN AIRLINES
AER LINGUS
CEBU Air, Inc
QANTASLINK
QATAR AIRWAYS
Etihad
Jetairways
Delta
American
  • 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

     

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    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

     

    • dodiyal's avatar
      dodiyal
      Frequent Visitor

      Thank you Greg, you are awesome ğŸ˜Š

  • Hi,

    Would it be possible to show the expected result in another column of Table1?