Netsuite: Creating Usage Report by Period - netsuite

I am trying to create a saved search that gives the quantity/sales amount in NetSuite for the previous months to track usage on an item, customer and sales rep level. I have somewhat of a solution however the way my formula is set up it is going off of the system date rather than the whole previous month(s). For example, if I ran the search today it would give me the usage from today (Feb 7) back to Jan 7, Dec 7 and Nov 7. But I know NetSuite has 'Period' as a date function and struggling to incorporate that instead.
My formula is below for an example.
NULLIF(CASE WHEN {trandate} > ADD_MONTHS(SYSDATE,-1) THEN CASE WHEN {type} = 'Invoice' THEN NVL({amount},0)*1 ELSE 0 END ELSE 0 END,0)
ADD_MONTHS(SYSDATE,-1) <---I change this to -2 and -3 to show previous 2 and 3 months as well
I am attempting to avoid doing 12 of these as a CASE WHEN posting period = P1 2021 THEN amount etc etc so we can have more of a rolling sales/quantity search.
Does not seem like NetSuite likes having to pull a point in time value, it likes to base searches/reports from the time it is run. But that could be being new'ish to NetSuite as we converted a few months ago.
Output of the saved search
Results with grouping and summarizing

TRUNC(ADD_MONTHS(SYSDATE,-2),'Month')-1

Related

Reinvoice every 12 months

Trying to create an invoice to auto populate. Have done this in VBA previously, but now the sheet is going on the cloud, and being used by Excel online so, VBA is out, unfortunately!
Trying to make a membership fee reappear every 12 months based on their start date!
I was trying around with EDATE, and got it to work on my test subject, but then realized it wouldn't work as I'm only going off the first 12 months!
Need a fresh set of eyes to give me ideas, or walk me through a simple solution (if possible)
Currently have the following, which works for the first year, then it won't!
Cell X7 = =EDATE(TODAY(),3) <----- Creates the cut off for invoicing if Membership due before then.
Cell V12 = =VLOOKUP(O12,'Youth Details'!$A$4:$H$95,8,0) <---- Returns their start date. i.e 19-Nov-2020
Cell W12 = =IF(AND(V12>TODAY(),V12<X7),"True", "False") <---- Returns if they have been with us for 9 months to 12 months and needs to be invoiced!
That works, for their first year, then the following year it won't invoice them as they've been there for 24 months.
I was thinking about expanding my VLOOKUP in cell V12, that if there membership was over 12 months ago, to add 12 to it, but got confused!
Any suggestions on where to go from here?
One way to do it might be
Figure the number of months they've been a member, like say 34.
Use the MOD() modulus function with a divisor of 12 (months). This will discard the number of whole 12-month-periods (years) they've been a member and leave you with just the number of months since their last anniversary. So for 34, it'd give "10" months since their 2-year anniversary.
If the answer from #2 says they're getting close to renewal, like they're 9+ months in to their current membership year, invoice them.
Cell V12: =VLOOKUP(O12,'Youth Details'!$A$4:$H$95,8,0) <---- Returns their start date, like 1-Jan-2019
Cell V13: =DATEDIF(V12, TODAY(), "M") <---- Total # of months they've been a member, like 34
Cell W12: =IF(MOD(V13, 12) >= 9, "True", "False") <---- Returns if it's been 9+ months since their last anniversary and they need to be invoiced!
Of course, if you allow people to prepay, then like AakashM points out it's worth making sure you're not invoicing them for something they've already paid.

Power Automate: Send reminder out 3 months in advance

I have a Microsoft List that has a column called Expiration Date (text in format of MM/DD/YYYY) and Point of Contact (text in format of email#domain.com). How do I create a flow that sends an email out to the Point of Contact 3 months in advance?
My idea was to create a scheduled cloud flow that:
Repeats every day
Looks at every row in specific list
Compares if Expiration Date - 3 Months = Today
If True, send email to Point of Contact
I am currently stuck on step 3 to compare the date. I did Subtract from time to subtract 3 months from Expiration Date but now I do not know how to use this value to compare to today's date.
A better approach is to filter the list by using an OData filter. That will result in a list with all the elements you need.
For doing so, you need to specify the "Filter Query" field (in red):
First type
ExpirationDate eq ''
Then, between the quotes, add an expression, and select the functions addDays and utcNow in the following way:
addDays(utcNow(),92,'MM/dd/yyyy')
Please notice the following:
I'm adding 92 days to get the same day three months in advance for today (today is Oct 18th, so I'm looking for Jan 18th). Maybe adding just 90 days would work for you.
If you just want to add 3 to the month, you would need to get today's date to a variable with utcNow('MM') to get only the month, add 3 to it, and then create the expression accordingly.
I'm sorry the UI is in spanish. I'm from Mexico. But it's the same idea.
In the image, it reads "ExpirationDateText" because that's the way I named the field in my example. In your case, "ExpirationDate" should work.

How to define a recursive function in Excel or how to define how long a field takes to change (Distance measured by Value_Column_X - Value_Column_Y)

The title of this question is assuming a way to solve it but what I need is the most simple way to get in Excel the following: -by most simple I mean in the terms of tools used; for example using VB is less simple that using Formulas and Pivot tables; the reason of the restriction is that my skills in Excel do not include VB or any other generic language.
There is a defects table with a daily sanpshot of the current testing status and I want to know how many days one defect in a given status X has been in this status.
For example the table could have records like:
ID
Date
Status
Calculated_Field_Consecutive_Days_In_Same_Status
23
1/Feb
Open
1
23
2/Feb
Open
2
23
3/Feb
Ready_For_Testing
1
23
4/Feb
Ready_For_Testing
2
23
5/Feb
Ready_For_Testing
3
23
6/Feb
Open
1
23
7/Feb
Ready_For_Testing
1
23
8/Feb
Closed
1
The following is not necessary to answer the question but nice if you have a useful comment on this.
Hint of how far I get: Using xloopup and simple formulas I can create a column that for each record tells me if the Status fields is new. But when I use this column to build a recursive function over the column itself where the base case is 1 and the recursive case is Value_of_Column for Predecesor_Record it does not work as Excel behaves as it is calculating the full column like an atomic operation instead of calculating one record after the other
Change Log:
On 21/2 Feb I change my table sample to show one scenario that I have not mentioned before and it is not covered by the first solution provided: The satus field can have a sequence like this one over time A,B,C,C,B,C and counter should be reset each time there is a change of value. In the case motivating this question it means that a defect can be Ready_for_Testing for 3 days but then the bug would be tested and if bug is still there it means the defect goes back to Open and eventually to Ready_for_Testing again with a counter of 1 day old.
assuming status for an ID is logged once a day, and the dates are sorted ascending
Try:
D2: =COUNTIFS($A$2:A2,A2,$C$2:C2,C2)
and fill down.

"Next X Hours" filter is not working as expected in CRM 2011

I have added a custom field named "due by" in queueitem entity. Then I created a system view named "Calls due next 1 hour" again in the queueitem entity with filter condition as:
Field: due by Filter: Next X Hours Value: 1
But this view seems to behave wrongly. E.g. Suppose current system time is say H:MM AM/PM, then this view is displaying all the records which are due by till H+1:59 AM/PM. While I am expecting it to display all the records which are due by till H+1:MM AM/PM only.
Because of this issue, my custom view is displaying records in the range or around next 1 - 2 hours. E.g. if the current system time is 10:01 AM it displays records till 11:59 AM which is around 2 hours whereas if current system time is 10:59 AM, it again displays records till 11:59 AM which is 1 hour.
This seems to be a bug in "Next X Hours" filter of CRM because I have checked it for some other entities as well by creating a custom view with "Next X Hour" filter where X is set to 1 and all are displaying records till 59th minute of next hour.
I have posted this issue here just to confirm whether this is really a bug or only I am facing this.
Thanks
This is something that I see in a lot of CRM views' pre-built filters, especially around date fields - the name of the field does not really indicate what it will do. In addition to your example, the "Last Year" filter to me would indicate that it should return results from the last 365 days ("in the last year"), but in reality it returns all results where the calendar year is equal to current year - 1 (same with last month, last week, next year, next month, etc.). Your question seems to be about the same concept (the next 1 hour is where hour = current hour + 1).
The only solution is to be sure to test out all the filters so you know exactly how they behave instead of relying on how you interpret the wording. It's a bit obnoxious, but it has to be done.

SharePoint column default values - add 10 working days

In SharePoint MOSS 2007, I have created a custom content type that I will be applying to a document library. One of the required fields is "Incoming Date" and another is the "Due Date".
The Due Date is always 10 working days from the Incoming Date. The Incoming Date is when the mail room received the letter, not necessarily when the document is posted to the library.
From here: http://msdn.microsoft.com/en-us/library/bb862071.aspx
=DATE(YEAR([Incoming Date]),MONTH([Incoming Date]),DAY([Incoming Date])+10)
adds 10 days, but how can I add 10 working days? I don't have the luxury of VS.NET either per the governance plan of our sharepoint rollout.
Assume a human is responsible for the data entry, but I would like to make it easier for them.
It's overkill for the very specific '10 days' requirement, but this should calculate a due date for any number of days from any start date.
I wrote it to match the result of Excel's WORKDAY function (which, given that every function in a calculated field is an Excel function, should almost be a thing). It's tested for 1 to 146 "days to complete", for each day of the week, and across years, without any sign of inconsistency. Unless I made a typo copying it from Excel, it should work as advertised. The only down side is that it doesnt do holidays, but if the users are accustomed to SharePoint they wont have expectations anyway. At all. Of any kind. For anything. Or hope. Or the muscles in their face that used to be responsible for smiling. Or the ability to look at a child and see anything but the bleak certainty of withering death. So, not a big deal if their task is due on Christmas. It's also sloppier than it probably needs to be.
=[Start Date]+[Days to Complete]
+ ROUNDDOWN([Days to Complete]/5,0)*2
+ IF(WEEKDAY([Start Date])+MOD([Days to Complete],5)>=7,2,0)
- ROUNDDOWN(WEEKDAY([Start Date])/7,0)
+ IF(AND(MOD([Days to Complete],5)=0,WEEKDAY([Start Date])=1),-2,0)
+ IF(AND(MOD([Days to Complete],5)=0,WEEKDAY([Start Date])=7),-2,0)
The first line is...obvious. The second line adds weekends. And the next 4 lines adjust for the deficiencies of the second line.
Firstly I should point out that you are making hard work of that formula, this will do the same.
=[Incoming Date] + 10
From the comments you have figured out that 10 working days (M-F) will always have 2 weekends so you can use this
=[Incoming Date] + 14
But this still doesn't take account of holidays
You are not going to be able to do this without some custom code in a workflow or possibly some javascript 'hack' and a database of holiday days for your region.
One possibility would be to default your Due Date to 10 working days from now when the record is created
=Today+14
and then rely on your users to manual alter this date if there are holidays in that period.
More details on this in a blog entry I've just written - Working Days, Weekends and Holidays in SharePoint Calculated Columns
Perhaps you can work around this limitation by using a workflow (possibly a custom one) to manage the due date? A due date implies that it is an actionable item that should be assigned to somebody anyways.
Note that VS.NET doesn't have to be a luxury - you can use it for free.
I believe I've figured out a fairly bullet-proof method for calculating a 10 business day deadline that accounts for holidays and weekends. 1) Calculate whether the 2 week period is a Monday, and if so, add only 11 days (assuming the start day counts as Day1 of your 10-day period). Otherwise, you add 13 to account for the 10 working days plus two weekends (remember, the start date already counts as Day1; your variables would be 12 and 14 if you did NOT count the start date as Day1). 2) Create a unique calculated column for every holiday and return a value of 1 if the holiday falls in the range. 3) Determine your "gross date" by adding values (weekends and holidays) to your start date. 4) Determine whether your gross date falls on a Saturday or Sunday, and if so, return the appropriate number of days to push off until Monday. 5) Add all the weekend, holiday, and added Sat and Sun values to your start date, which gives you your due date.
NOTE: The only challenges I see here is if a holiday pushes the due date into the weekend, which then pushes the due date to a Monday that happens to be yet another holiday. This didn't happen in my holiday schedule, but it might in yours. In addition, you'll need to keep adding new holidays every year, thus requiring you to recreate the column arrays from scratch for a long-running list. Alternatively, you could start a new list every year.
C_Wknd =IF(TEXT(WEEKDAY([Complaint Created On]),"ddd")="Mon",11,13)
C_NYDay =IF(AND([Complaint Created On]<=DATE(2009,1,1),([Complaint Created On])+C_Wknd>=DATE(2009,1,1)),"1","0")
C_MLKDay =IF(AND([Complaint Created On]<=DATE(2009,1,19),([Complaint Created On])+C_Wknd>=DATE(2009,1,19)),"1","0")
C_MemDay =IF(AND([Complaint Created On]<=DATE(2009,5,25),([Complaint Created On])+C_Wknd>=DATE(2009,5,25)),"1","0")
C_PresDay =IF(AND([Complaint Created On]<=DATE(2009,2,16),([Complaint Created On])+C_Wknd>=DATE(2009,2,16)),"1","0")
C_IndDay =IF(AND([Complaint Created On]<=DATE(2009,7,4),([Complaint Created On])+C_Wknd>=DATE(2009,7,4)),"1","0")
C_LabDay =IF(AND([Complaint Created On]<=DATE(2009,9,7),([Complaint Created On])+C_Wknd>=DATE(2009,9,7)),"1","0")
C_ColDay =IF(AND([Complaint Created On]<=DATE(2009,10,12),([Complaint Created On])+C_Wknd>=DATE(2009,10,12)),"1","0")
C_VetDay =IF(AND([Complaint Created On]<=DATE(2009,11,11),([Complaint Created On])+C_Wknd>=DATE(2009,11,11)),"1","0")
C_ThxDay =IF(AND([Complaint Created On]<=DATE(2009,11,26),([Complaint Created On])+C_Wknd>=DATE(2009,11,26)),"1","0")
C_XmsDay =IF(AND([Complaint Created On]<=DATE(2009,12,25),([Complaint Created On])+C_Wknd>=DATE(2009,12,25)),"1","0")
C_GrossDte =[Complaint Created On]+C_Wknd+C_NYDay+C_MLKDay+C_MemDay+C_PresDay+C_IndDay+C_LabDay+C_ColDay+C_VetDay+C_ThxDay+C_XmsDay
C_EndSat =IF(TEXT(WEEKDAY(C_GrossDte),"ddd")="Sat",2,0)
C_EndSun =IF(TEXT(WEEKDAY(C_GrossDte),"ddd")="Sun",1,0)
Resolution Due =C_GrossDte+C_EndSat+C_EndSun

Resources