Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
dodiyal
Frequent Visitor

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

 

dodiyal_0-1675619365342.png

 

So WK5  will show 167-25=142

And it goes on till the value becomes 0

 

dodiyal_1-1675619459704.png

 

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

dodiyal_2-1675619534995.png

 

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.

 

dodiyal_3-1675620198601.png

 

 

 

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
1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community 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

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

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


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Greg_Deckler
Community Champion
Community 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

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you Greg, you are awesome 😊

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.