Help with a formula needed - Trying to create a su...
# general
m
Help with a formula needed - Trying to create a summary item saved search which sums the inventory location available for 2 locations however should only provide a value for location 1 if at the point of running the search, it is between 12 and 2pm... currently I have this as a formula numeric (sum) as part of the results:
((CASE WHEN {type} IN ('Assembly', 'Inventory Item') AND {inventorylocation} = 'ABC' THEN NVL({locationquantityavailable}, 0) ELSE 0 END + CASE WHEN {type} IN ('Assembly', 'Inventory Item') AND {inventorylocation} = 'SSS' THEN NVL({locationquantityavailable}, 0) ELSE 0 END)) + CASE WHEN {type} IN ('Non-inventory Item') THEN NVL({custitem_wer}, 0) ELSE 0 END
and want something like:
((CASE WHEN {type} IN ('Assembly', 'Inventory Item') AND {inventorylocation} = 'ABC' AND TO_NUMBER(TO_CHAR(NOW(), 'HH24')) BETWEEN 12 AND 13 THEN NVL({locationquantityavailable}, 0) ELSE 0 END + CASE WHEN {type} IN ('Assembly', 'Inventory Item') AND {inventorylocation} = 'SSS' THEN NVL({locationquantityavailable}, 0) ELSE 0 END)) + CASE WHEN {type} IN ('Non-inventory Item') THEN NVL({custitem_wer}, 0) ELSE 0 END
m
(CASE WHEN {type} IN ('Assembly', 'Inventory Item') AND {inventorylocation} = 'ABC' AND TO_NUMBER(TO_CHAR({today},'HH24')) BETWEEN 12 AND 14 THEN NVL({locationquantityavailable}, 0) ELSE 0 END + CASE WHEN {type} IN ('Assembly', 'Inventory Item') AND {inventorylocation} = 'SSS' THEN NVL({locationquantityavailable}, 0) ELSE 0 END) + CASE WHEN {type} IN ('Non-inventory Item') THEN NVL({custitem_wer}, 0) ELSE 0 END
🙏 1
d
FWIW, you can just use a single CASE statement, as the SUM summary-type will do the work for you. Can be simplified as: