Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hello all, once again i am struggling with a fault in my PBI file. This time i have a formula that calculates if there is enough of an item in stock. Stock - needed for project = leftover stock
Stockformula (measure) (which is correct):
Solved! Go to Solution.
Hi @JimmyBos can you please replace with below:
var Totaal = SUM(POStuklijst[gbkmut.aantal])
or try this:
var Totaal = MAX(POStuklijst[gbkmut.aantal])
Use CALCULATE to Apply the Right Context Try explicitly filtering the stock calculation
StockQTY-TotaalBehoefte =
VAR StockQTY = SELECTEDVALUE(InkoopArtikelenStockqty[StockQty])
VAR Totaal = CALCULATE(
SUM(POStuklijst[gbkmut.aantal]),
ALL(POStuklijst) -- Remove filters to check total
)
RETURN StockQTY - Totaal
Use CALCULATE( SUM(POStuklijst[gbkmut.aantal]), ALL(POStuklijst) ) to debug filtering.
Check table relationships and use RELATED() if needed.
Ensure gbkmut.aantal is numeric.
Hope this helps.
Proud to be a Super User! | |
Hi @JimmyBos can you please replace with below:
var Totaal = SUM(POStuklijst[gbkmut.aantal])
or try this:
var Totaal = MAX(POStuklijst[gbkmut.aantal])
Use CALCULATE to Apply the Right Context Try explicitly filtering the stock calculation
StockQTY-TotaalBehoefte =
VAR StockQTY = SELECTEDVALUE(InkoopArtikelenStockqty[StockQty])
VAR Totaal = CALCULATE(
SUM(POStuklijst[gbkmut.aantal]),
ALL(POStuklijst) -- Remove filters to check total
)
RETURN StockQTY - Totaal
Use CALCULATE( SUM(POStuklijst[gbkmut.aantal]), ALL(POStuklijst) ) to debug filtering.
Check table relationships and use RELATED() if needed.
Ensure gbkmut.aantal is numeric.
Hope this helps.
Proud to be a Super User! | |
Hello @rajendraongole1 , you must be one of the most active members on this forum! Glad to see your name again.
So i tried your idea's, below the results:
Both the SUM and MAX idea gave me the same error.
There has been detected a circular in dependency: POStuklijst[Vold. Besteld?], POStuklijst[JA/NEE Genoeg besteld], POStuklijst[Vold. Besteld?}.
Then the complete formula with the calculate. This formula gives all the same answers for each row. Every single row (each item) now has the value '-1.879.578,59'.
gbkmut.aantal is indeed numeric.
So the formula i have right now (changed it a little with your idea):
StockQTY-TotaalBehoefte =
VAR StockQTY = SELECTEDVALUE(InkoopArtikelenStockqty[StockQty])
var Totaal = SELECTEDVALUE(POStuklijst[gbkmut.aantal])
RETURN StockQTY - Totaal
Most results are still correct, some are wrong. Below a screenshot, i have marked wrong and correct.
Any idea why some of the results are wrong? The formula is quite simple right? Left column - middle column = right column.
Hello @rajendraongole1 , Seems the problem has been solved! in your previous post you talked about changing the formula in: var Totaal = SUM(POStuklijst[gbkmut.aantal])
This gave me the following error.
There has been detected a circular in dependency: POStuklijst[Vold. Besteld?], POStuklijst[JA/NEE Genoeg besteld], POStuklijst[Vold. Besteld?}.
After changing some of the other formula's, now the error has disappeared! Thanks again!
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 57 | |
| 52 | |
| 40 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 115 | |
| 106 | |
| 41 | |
| 34 | |
| 25 |