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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Sum all previous rows by column value

Greetings,

 

I need help with a formula. I'm new into DAX (Power BI), I've tried many solutions but none worked as intended.

 

I have this table in excel:

Row/LineABCD
1ItemQty. NeededStockMissing
2A210No
3A110No
4B37No
5A110No
6A210No
7B57No
8B17Yes
9A310No
10A410Yes
11A410Yes

 

In excel, I have a IF with SUM.IF, formula, lets consider we are looking at Missing column at line 5, it'll look like this:

 

IF(C5 < SUM.IF(A$1:A5 ; A5 ; B$1:B5) ; "Yes" ; "No")

 

This checks all rows until the one it is in. (So row 5 checks all rows until row 5)

It sums all "Qty. Needed" if the Item is equal to the Item in row 5.

If the sum is more than the Stock, writes "Yes", otherwise, "No".

 

I've tired using EARLIER, CALCULATE, SUMX, but I couldn't figure anything that would work. I hope someone more expirienced has a solution.

 

If you have any questions, I'm happy to try and reply them.

 

Thank you all.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

the rules of calculation and comparison are not entirely clear to me. But maybe this is what you are looking for

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

the rules of calculation and comparison are not entirely clear to me. But maybe this is what you are looking for

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors