Forum Discussion

JimmyBos's avatar
JimmyBos
Helper II
1 year ago
Solved

Incidental wrong stockvalue

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   S...
  • rajendraongole1's avatar
    1 year ago

    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.