NetSuite cycle count accuracy formula - netsuite

I am attempting to build a saved search that measures our inventory cycle counts. I am using the saved transaction search to do this. I have been able to build out everything I want with the exception of Count Accuracy.
Here is what I have:
sum(Case when {transactionlinetype} = 'Adjusted Quantity' then abs({quantity}) Else 0 END) /
sum(Case when {transactionlinetype} = 'Snapshot Quantity' then {quantity} Else 0 END)
The goal is to get the % value of Item counted and divide it by the number of issues.
To provide the working example: I have 10 items to count, each item has 10 on hand so I have 100 items counted, 3 of those items had issues so my result should be 3%
I have looked for answers but have not been successful.

You don't say what result you're getting, or what the error is, but when I tried with your formula I got a 'possible divide by 0' error. The solution to this is to wrap the denominator in a nullif() function, so you could use:
sum(Case when {transactionlinetype} = 'Adjusted Quantity' then abs({quantity}) Else 0 END) /
nullif(sum(Case when {transactionlinetype} = 'Snapshot Quantity' then {quantity} Else 0 END),0)

What you are trying to do is like a subquery which is not possible in NS saved search.

Related

I have three values and budget and i need to buy a product at the best price in python

The condition is as follows:
I have a budget of 500 EUR.
There are three bikes at different prices.
I need to buy a bike at the best price
If I set the budget to 0 then I get an else print, but if I change the budget to 1 then I get a successful if print even though my budget is less than the price of the bike.
Maybe you can help and explain what I'm doing wrong?
CODE:
budget = 500
bikeUnivega = 375
bikeKalkhoff = 449
bikeFocus = 462
bikeCatalogList = (bikeUnivega, bikeKalkhoff, bikeFocus)
lowestBikePrice = bikeCatalogList.index(min(bikeCatalogList))
if budget > lowestBikePrice:
print(f'I Will buy the bike for the lowest price of {bikeCatalogList[lowestBikePrice]} EUR.')
else:
print('I dont have enough money for the bike. I will save money until next year.')
I tried to find the information on google, but I was unsuccessful.
There are a couple things I've noticed in your code:
For starters, your list is using () like a tuple, instead of [].
Next is that lowestBikePrice is not returning the value stored in the variable, but its index.
So, if you were to get the min, it returns a 0 bc the lowest value variable is in position 0.
If you were to use a max instead, it would return a 2.
lastly your f string is hashing your list for an item lowestBikePrice which doesn't exist in the list.

Excel formula - calculate the highest team start position deducted from the highest team finish position

Is there a excel formula that is able to calculate the highest team start position deducted from the highest team finish position and (if the result is positive) multiplied by 5 to a maximum of 50?
in the above example Team T's highest start position was 13th and there highest finish position was 9th so 4 places difference * 5 = 20 ( added to D10 and 0 in D2 can be either way round so the team score is only calculated once )
Thanks
Use MINIFS():
=MIN(IF(C2=MINIFS(C:C,A:A,A2),MINIFS(B:B,A:A,A2)-MINIFS(C:C,A:A,A2),0)*5,50)
Give this a shot:
IF(ISERROR(MATCH(A11,$A$1:A10,0)),MIN((MINIFS($B$2:$B$21,$A$2:$A$21,A11)-MINIFS($C$2:$C$21,$A$2:$A$21,A11))*5,50),0)
to break this down:
IF(ISERROR(MATCH(A11,$A$1:A10,0))
<== first well check to see if this If I've calculated this team, by trying to match against the team list, up to this point. Match() returns a numeric for a hit (already done ==> return zer0), or #NA (error) for a new (not already found) instance of the team.
MIN( <= take the lessor of the next calculation or 50
(MINIFS($B$2:$B$21,$A$2:$A$21,A11) <= Return the lowest MIN() START (B:B) where all A11's are found in the list A2:A21
- <= and deduct from
MINIFS($C$2:$C$21,$A$2:$A$21,A11)) <=== <= Return the lowest MIN() FINISH (C:C) where all A11's are found in the list A2:A21
*5 <==and multiply result by 5
,50) <== or return 50 from MIN above)
,0) <= from if() above
Hope this works for you.

Performing calculation of two separate case statements

I have created a saved search in NetSuite which displays two separate case statements.
1- case when {transaction.type} = 'Item Receipt' and {transaction.account} = '5505 Cost of Goods Sold : Product Cost' or {transaction.type} = 'Item Fulfillment' and {transaction.account} = '5505 Cost of Goods Sold : Product Cost' then {transaction.amount} else null end
2- case when {transaction.type} = 'Invoice' or {transaction.type} = 'Cash Sale' or {transaction.type} = 'Cash Refund' or {transaction.type} = 'Credit Memo' then {transaction.amount} else null end
Now I need to add third column in which I can display % by dividing result values between case case statement 1 and 2. Any advise how is that possible? Thanks!
As Brian mentioned (and I presume you are doing) grouping is the easiest way.
You can use Minimum (as shown), Maximum, or Average for the Formula (Percent) field.
The IN statement shown above would also simplify your formulas.
Edit:
To avoid the Possible Divide by Zero error:
SUM(case when {transaction.account} = '5505 Cost of Goods Sold :Product Cost' and {transaction.type} in ('Item Fulfillment','Item Receipt') then {transaction.amount} else 0 end) / NULLIF( SUM(case when {transaction.type} in ('Invoice','Cash Sale','Cash Refund','Credit Memo') then {transaction.amount} else 0 end) ,0)

Can't figure out why my loop wont exit and print a the right time

Write a while loop that calculates the product of the integers from 1 to 20, but which stops after the accumulated product exceeds 1 billion (1000000000). Print the value of your calculated product afterward.
Hint: You'll find the break statement handy for this challenge, and you'll probably want to accumulate your product by doing something like this: product *= i. That means you'll need to initialize your product accumulator to 1, as you've shown below.
see code
i = 1
product = 1
while i<21:
product *= i
i += 1
if product > 1000000000000:
break
print(product)
I want the loop to exit once the product exceeds 1 billion and print that number right now the out put is 1307674368000 but know it should be 6227020800.
Your loop currently exits at one trillion. Change that to one billion and the output is as expected:
i = 1
product = 1
while i < 21:
product *= i
i += 1
if product > 1000000000:
break
print(product)
Output
6227020800
Your code is correct but you used 1000000000000 instead of 1000000000. To prevent such problems, use underscore:
if product > 1_000_000_000:
break

how to count of issue with open status in spotfire

I need to calculate count of issue ID for each month with open status.
I have below 3 columns-
Issue_ID
Issue_Open_Date
Issue_Closed_Date
Issue_ID Issue_Open_Date Issue_Closed_Date Open_Issue_Count(required output)
IS_10 11/11/2014 1/5/2015 3
IS_11 11/12/2014 12/14/2014
IS_12 11/13/2014 11/15/2014
IS_13 11/14/2014 3/5/2015
IS_1 12/1/2014 12/15/2014 4
IS_2 12/2/2014 2/10/2015
IS_3 12/3/2014 1/15/2015
IS_4 1/1/2015 2/10/2015 4
IS_5 1/2/2015 3/11/2015
IS_6 1/3/2015 1/22/2015
IS_7 2/1/2015 3/5/2015 3
IS_8 2/2/2015 2/2/2015
IS_9 2/7/2015 2/28/2015
IS_14 3/1/2015 4/5/2015 1
Based on above table, i need a count of open status of each month.
lets suppose in December i need to count than it should check in dec and nov month.
If any issue is closing in same month, it mean that is not in open stage,
Basically for each month it should check for their records also and previous month records also.
Required output is below-
Nov- 3
Dec- 4
Jan-4
Feb-3
march-1
So... I have a way but it's ugly. I'm sure there's a better way but I spent a while banging my head on this trying to make it work just within Spotfire without resorting to a python script looping through rows and making comparisons.
With nested aggregated case statements in a Cross Table I made it work. It's a pain in the butt because it's pretty manual (have to add each month) but it will look for things that have a close date after the month given and an open date that month or earlier.
<
Sum(Case
when ([Issue_Closed_Date]>Date(2014,11,30)) AND ([Issue_Open_Date]<Date(2014,12,1)) then 1 else 0 end) as [NOV14_OPEN] NEST
Sum(Case
when ([Issue_Closed_Date]>Date(2014,12,31)) AND ([Issue_Open_Date]<Date(2015,1,1)) then 1 else 0 end) as [DEC14_OPEN] NEST
Sum(Case
when ([Issue_Closed_Date]>Date(2015,1,31)) AND ([Issue_Open_Date]<Date(2015,2,1)) then 1 else 0 end) as [JAN15_OPEN] NEST
Sum(Case
when ([Issue_Closed_Date]>Date(2015,2,28)) AND ([Issue_Open_Date]<Date(2015,3,1)) then 1 else 0 end) as [FEB15_OPEN] NEST
Sum(Case
when ([Issue_Closed_Date]>Date(2015,3,31)) AND ([Issue_Open_Date]<Date(2015,4,1)) then 1 else 0 end) as [MAR15_OPEN]>
Screenshot:
As far as doing it with python you could probably loop through the data and do the comparisons and save it as a data table. If I'm feeling ambitious this weekend I might give it a try out of personal curiosity. I'll post here if so.
I think what makes this difficult is that it's not very logical to add a column showing number of issues open at a point in time because the data doesn't show time; it's "one row per unique issue."
I don't know what your end result should be, but you might be better off unpivoting the table.
unpivot the above data with the following settings:
pass through: [Issue_ID]
transform: [Issue_Open_Date], [Issue_Closed_Date]
optionally rename Category as "Action" and Value as "Action Date"
now that each row represents one action, create a calculated column assigning a numeric value to the action with the following formula.
CASE [Action]
WHEN "Issue_Open_Date" THEN 1
WHEN "Issue_Closed_Date" THEN -1
END
create a bar chart with [Action Date] along the X axis (I wouldn't drill further than month or week) and the following on the Y axis:
Sum([Action Numeric]) over (AllPrevious([Axis.X]))
you'll wind up with something like this:
you can then do all sorts of fancy things with this data, such as show a line chart with the rate at which cases open and close (you can even plot this on a combination chart with the pictured example).

Resources