NetSuite Saved Searches I want to use the ship date and deduct 7 working days from it - netsuite

I am new to formulas on NetSuite Saved Searches but need some help. I want to use the ship date and deduct 7 working days from it

Keep in mind that Netsuite is based on Oracle database, so if you need any special calculation, just check how to do it using Oracle SQL. In your case, you just need to add a Formula result column of type Date and use the formula:
TO_DATE({internalid_shipdate_field} - 7)

You can add the formula in the formula(date) field in SS:-
CASE
WHEN to_char({shipdate},'DY') = 'MON' THEN {shipdate} - 11
WHEN to_char({shipdate},'DY') = 'TUE' THEN {shipdate} - 11
WHEN to_char({shipdate},'DY') = 'WED' THEN {shipdate} - 9
WHEN to_char({shipdate},'DY') = 'THU' THEN {shipdate} - 9
WHEN to_char({shipdate},'DY') = 'FRI' THEN {shipdate} - 9
WHEN to_char({shipdate},'DY') = 'SAT' THEN {shipdate} - 9
WHEN to_char({shipdate},'DY') = 'SUN' THEN {shipdate} - 10
END
Table to show how I get the no. of days to deduct

Related

NetSuite Saved Search Formula for This Week

I am trying to create a saved search that shows total orders today, yesterday, this week and this month. I am able to get all but the weekly one using date formulas.
All are Formula(Numberic) fields with summary type Count.
Today: CASE WHEN {trandate} = to_date({today}) THEN {number} END
Yesterday: CASE WHEN {trandate} = to_date(({today} - 1)) THEN {number} END
This Week??
This Month: CASE WHEN {trandate} BETWEEN to_date(TRUNC({today}, 'MONTH'), 'MM/DD/YYYY') AND to_date(LAST_DAY{today}) THEN {number} ELSE 0 END
Any suggestions appreciated!
The way to get this depends on whether you want values for the last 7 days or for this calendar week.
For the last 7 days:
case when {now} - {trandate} < 7 then {number} else 0 end
or for the current week
case when to_char({now}, 'IW') = to_char({trandate}, 'IW') then {number} else 0 end
where 'IW' is for the ISO Standard week numbering. You can also use 'WW' for week numbering where week 1 starts on Jan 1, week 2 on Jan 8 etc.
I'd suggest calculating the day of the week and using that to work back to the start of the week.
I have not tested, but my understanding is that Oracle db functions should work.
to_date({today} - to_char({trandate}, 'D'))
https://livesql.oracle.com/apex/livesql/file/content_GCEY1DN2CN5HZCUQFHVUYQD3G.html

Creating flags for calculating rolling averages in excel

I have a data sheet which looks like:
year month
2017 2017-01
2017 2017-02
2017 2017-03
......
2018 2018-04
2018 2018-05
Note the column month contains text string. I need to create a new column flag in excel which filters which months are to be used in calculating rolling 12M averages for current month and which months are to be used for calculating rolling 12M averages for previous year.
For example today's date is 5/24/2018, so month 2018-05 will be marked as "current". months between 2018-04 to 2017-05 will be marked as "both". month 2017-04 will be marked as "previous". Rest all months will be marked as NA. My final data should look like this:
year month flag
2017 2017-01 NA
2017 2017-02 NA
2017 2017-03 NA
2017 2017-04 Previous
......
2018 2018-04 Both
2018 2018-05 Current
I am having trouble implementing this logic in excel as the column month is a text string and simply using IF condition doesn't works for me. Any leads on this is appreciated.
Edit:
I tried converting the months to a number by using =DATEVALUE(B2 & "-01").
I stored the number for current month in a variable curr.
Now I am using the following formula =IF(B22=curr,"Current", IF(B2=curr-395,"Previous","Both")).
This creates the flag column which I require although there's still an issue based on whether the month has 30 or 31 days. Any solutions for this please?
One way to do it is to use DATDIF.
=DATEVALUE(B2 & "-01") will give you the first of each month in column B.
To return the month number use =DATEDIF(C2,TODAY(),"m") where column C holds the DATEVALUE formula. This will return 0 for this month, 1 for last month... 13 for April 2017.
Now check to see if the count of months = 0 then it's current, if it's greater than 11 it's NA, otherwise it's both. =IF(D2=0,"Current",IF(D2>11,"NA","Both"))
... Edit ....
That's wrong - forgot the "Previous" and "Both" isn't 12 months ....
=IF(D2=0,"Current",IF(D2>13,"NA",IF(D2=13,"Previous","Both")))
As considering your column month format = "YYYY-MM" this code may be helpful
this is Excel function, to use it you need to save this function in the module and use it. `
Function MyDateCal(cell As Range) As String
Dim YearCurrent, YearCell, monthCurrent, MonthCell As Integer
Dim cellVal As String, DiffMonth As Integer[![enter image description here][1]][1]
cellVal = cell.Value
MyDateCal = "NA"
'cellVal = Cells(1, 1).Value
YearCurrent = Year(Now())
monthCurrent = Month(Now())
YearCell = CInt(Left(cellVal, 4))
MonthCell = CInt(Right(cellVal, 2))
DiffMonth = 12 * (YearCurrent - YearCell) + (monthCurrent - MonthCell)
If DiffMonth = 0 Then
MyDateCal = "Current"
ElseIf DiffMonth > 0 And DiffMonth <= 12 Then
MyDateCal = "Both"
ElseIf DiffMonth = 13 Then
MyDateCal = "Previous"
End If
End Function
`

Convert timestamp to date in Excel pivot table

I have a pivot table which currently looks like this:
No of Sales
Team 1
2017-03-10T07:10:20.289Z 1
2017-03-10T07:10:22.289Z 4
2017-03-14T07:08:20.289Z 10
Team 2
2017-03-11T07:14:20.289Z 11
I want to group by the date in the timestamp and only show the date and the total for that day so it looks like this instead:
No of Sales
Team 1
2017-03-10 5
2017-03-14 10
Team 2
2017-03-11 11
How can I do this?
you can do the rest of the code, but the important part is:
strTemp= cells(row, col).value 'this contains the date 2017-03-10T07:10:20.289Z
strDate = split(strTemp, "T")(0)
That's it.

NETSUITE - Saved Search - Show employees are one year old today

How to make and saved search to verify todays employee has exactly 1 year on company.
Example:
employee1 hiredate = 10/02/2015
employee2 hiredate = 11/02/2015
employee3 hiredate = 10/02/2012
employee4 hiredate = 10/02/2008
employee5 hiredate = 13/04/2008
Get saved search with all employee are 1 or more years old.
The result will be if today are 10/02/2016:
employee1 = 1 year on company.
employee3 = 4 year on company.
employee4 = 8 years on company.
Thats possible?
My wrong formula are:
MOD((ROUND({today},'DAY')-ROUND({hiredate},'DAY'))/365, 1) is 0
Thanks!
You should not need a formula at all for this. You can just set up a filter on your saved search where the field is "Hire Date", the operator is "on or before", and the value is "same day last fiscal year". If you only want exactly one year ago, you can use "on" instead of "on or before".
If you want Employees that are more than 1 year but less than 2 years, then just add a second filter of "Hire Date - on or after - same day fiscal year before last".
I was able to achieve the same using the below formula(numeric) filter:
MOD(MONTHS_BETWEEN({today}, {hiredate}),12) is equalto 0
this will give you the employees having anniversary.
To get the number of years add the formula(numeric) search column with formula:
FLOOR(MONTHS_BETWEEN({today}, {hiredate})/12)

Excel: Count billing hours for specific month, week, year

I have four columns in a spreadsheet, Month, Week, Year, Hours and I want to 'sum' the number of hours based on the month, week, and year number. Months would be (1-12), week would be (1-52), and year would be (2009, 2010, 2011)
For example:
Month Week Year Hours Total_Hours
1 2 2011 8 12
1 2 2011 4 12
1 2 2010 7 7
1 2 2009 5 5
Not sure if I should use vlookup or a nest 'if'. If someone else has a better approach, please let me know.
Thanks in advance.
First, you create another column that is a string concatenation of the first three, and drag down:
=TRIM(A2) & TRIM(B2) & TRIM(C2)
Then, you use this formula for Total_Hours, and drag down:
=SUMIF(D:D, D2, E:E)
My example uses your sample, and inserts a new column D for the concatenation.
End Result:
Month Week Year Concat Hours Total_Hours
1 2 2011 122011 8 12
1 2 2011 122011 4 12
1 2 2010 122010 7 7
1 2 2009 122009 5 5
Of course, I'd use Named Ranges for anything that's likely to change.
If you use VLOOKUP ensure the textual data is formatted correctly or use Text and Data functions

Resources