need help in building a formula in saved search - ...
# suiteanalytics
j
need help in building a formula in saved search - it should be possible - i am looking for picking sum of highest amount of same item per order - e.g. order xyz - item a 100, item b 100, item a 200, item b 50, item c 300, item a 80, so in this case I need to get item a as highest i.e. 380 - its easy to do in sql by partitioning by item and summing - but unable to do in netsuite as many syntax are differnt in formulas
s
@j.j If you are trying to show the highest amount, then it would be possible. But your order has the same item 'b' repeated twice with different QTY. So NetSuite does not know if it needs to show the Max or Sum. If you are trying to show max of the item's QTY in any given order the following would be a solution. I would love to know if there's other solution to sum up the maximum QTY.
b
try using the SUM function in the formula in combination with Summary columns
j
thanks for helping - but this will not help - basically what i need is similar to sum(quantity) over (partition by item)
b
quantities look right for formula + summary columns
j
thanks battk so far so good - now can you show 380 in all lines
b
same thing with no summary columns if you use your formula as well
although i dont think you will be easily able to get 380 in all of them
j
its possible in sql just in netsuite the syntax and support is different, though i am sure its possible in netsuite also
b
if you wanted to use sql, you should be trying SuiteQL
saved searches use sql, but a very specific subset of it
j
thanks bro for helping so much - will first try in saved search as i am pretty sure its possible
in simple words i need this MAX({grossamount}) OVER (PARTITION BY {item}) working in search but it gives unexpected error
b
Copy code
MAX ({quantity}) OVER (PARTITION BY {item})
should work fine by itself with no summaries
If you want to use analytical functions you might have success adding a comment
b
i was lazy and used a space instead, but comment is probably better