Hello
I have a dataset coming via direct query from NAV item entry tables and I need to filter out exactly the transaction lines I need to get the correct quantities from the production line. I need to include rows where the item number starts with RM (raw material) or IM (semi processed). A typical item no is RM00012.
I can get the right answer for just RM or just IM by using;
Consumption Quantity = -DIVIDE((
CALCULATE(SUM('nav Item Ledger Entry'[Quantity]),
FILTER('nav Item Ledger Entry', 'nav Item Ledger Entry'[Entry Type] = 5),
FILTER('nav Item Ledger Entry', 'nav Item Ledger Entry'[Unit of Measure Code] = "PCS"),
FILTER('nav Item Ledger Entry', LEFT('nav Item Ledger Entry'[Item No_],2) = "RM"))),
[UOM Qty if KG],0)
but is there a way of doing this in one query? I have tried..
Consumption Qty = -DIVIDE(
(CALCULATE(SUM('nav Item Ledger Entry'[Quantity]),
FILTER('nav Item Ledger Entry', 'nav Item Ledger Entry'[Entry Type] = 5),
FILTER('nav Item Ledger Entry', 'nav Item Ledger Entry'[Unit of Measure Code] = "PCS"),
FILTER('nav Item Ledger Entry',
LEFT('nav Item Ledger Entry'[Item No_],2) = "RM" &&
LEFT('nav Item Ledger Entry'[Item No_], 2) = "IM"))),[UOM Qty if KG],0)
I have tried....
Consumption Qty = -DIVIDE(
(CALCULATE(SUM('nav Item Ledger Entry'[Quantity]),
FILTER('nav Item Ledger Entry', 'nav Item Ledger Entry'[Entry Type] = 5),
FILTER('nav Item Ledger Entry', 'nav Item Ledger Entry'[Unit of Measure Code] = "PCS"),
FILTER('nav Item Ledger Entry',
OR(
LEFT('nav Item Ledger Entry'[Item No_],2) = "RM" ,
LEFT('nav Item Ledger Entry'[Item No_], 2) = "IM"))),[UOM Qty if KG],0)
But neither work, also it seems the multiple filters are causing performance issues so is there a generally better way of tackling this?
Many thanks