list view
1 TopicSum interval considering many filters
Hello everyone, I have been here a time ago to solve a problem within this same topic, the thing is, the solution was complete but i found out that one other thing was needed. I need the following dax code, not to consider all the order as "out", when the sum of items reach the total of stok available, but, i need to test others orders to see if the amount of the stok can be used still, axample: i have orders 333, 444 and 555 with the item bbb, with quantities 2, 30 and 5, the stok is 10 for this item, the actual code, tests the stok to the orders and the result is : available, ou, out; but i need the result to be: available, out, available.. of course, following the same logic of the earlier order num, only inside of the range date i select. When i select the date 01/03/25 to 01/03/25, the only orders that have in this date are the in the example.. Measure = VAR _date = CALCULATE(MAX('Table date'[date]), ALLSELECTED('Table date')) VAR _quantity = CALCULATE( SUM('Table orders'[quantity]), FILTER( ALLSELECTED('Table orders'), [Item] = MAX('Table orders'[Item]) && [date] <= MAX('Table orders'[date]) && [Order num] <= MAX('Table orders'[Order num]) -- Considera o número do pedido ) ) VAR _stock = CALCULATE( SUM('Table stock'[quantity]), FILTER( ALL('Table stock'), [item] = MAX('Table orders'[Item]) ) ) VAR _result = IF(_quantity <= _stock, "available", "out") RETURN IF(ISBLANK(_quantity), BLANK(), _result) Thankyou a lot allready!Solved1.2KViews0likes6Comments