Explanation of what is going on with this query using "ROUND" function - rounding

Just need some clarification on how this round function is working so I can use it in some of my own work.
SELECT "OrderId","CustomerId","OrderNumber","OrderDate",
ROUND(TO_DATE(sysdate,'dd-mm-yy')-"OrderDate",1)AS "Number Of Days",
ROUND((TO_DATE(sysdate,'dd-mm-yy')-"OrderDate")/30.4167,1)AS "Number Of Months"
FROM "SA_Order" WHERE "Fulfilled"='Y';
This is the original query:
Display all the Orders that have been fulfilled and the numbers of days since the order date (round down
to one decimal place).
I'm struggling to find other examples that explain what is actually going on within the query.

Related

How can I calculate the number of lost weather days in Excel?

I have done some programming in the past, so I would be able to figure this problem out in a programming language. But, I do not know how to proceed with accomplishing my task in an Excel spreadsheet. Any kind of guidance would be helpful because I am not familiar with anything but a basic use of MS Excel, so I don't even know which topics to search for to get some guidance on solving this problem.
Here is the breakdown for my problem:
I work for a construction company and I am keeping count of the number of days which need to be extended to a schedule deadline. All "lost weather days" are in a column (assume they are in chronological order and there are not bad dates like 2/32/22).
Contractually, we eat the first 5 lost weather days for any given month. But, if there are more than 5 lost weather days in any given month, then I need to add those days to a count by which the schedule deadline can be extended. So, any time a month has more than 5 lost weather days, I need to start counting.
For example:
DATE
1/1/23
1/2/23
1/13/23
1/14/23
1/25/23
1/26/23
1/27/23
2/1/23
2/12/23
Here, 1/6/23 and 1/7/23 need to be counted while all of the other dates are ignored because 1/1/22, 1/2/22, 1/3/22, 1/4/22, and 1/5/22 are the first five days in January 2023. So, I should have a cell with a value of 2.
Any help or guidance would be appreciated. Thank you.
I haven't tried anything specific because I am unfamiliar with excel at the moment.
=LET(m,EOMONTH(TRANSPOSE(A2:A10),0),
f,FREQUENCY(m,m),
SUM(IF(f>5,f-5)))
This first converts the dates in the same month(/year) to the same date being the end of that month.
Then FREQUENCY counts the number of days being the same per month. Then, if the frequency is higher than 5, 5 is substracted, else ignored.
For older Excel versions:
=SUM(
IF(
FREQUENCY(
EOMONTH(TRANSPOSE(A2:A10),0),
EOMONTH(TRANSPOSE(A2:A10),0)
)>5,
FREQUENCY(
EOMONTH(TRANSPOSE(A2:A10),0),
EOMONTH(TRANSPOSE(A2:A10),0)
)-5)
)
With Office 365:
=LET(rng,A2:A10,uq,UNIQUE(DATE(YEAR(rng),MONTH(rng),1)),SUM(BYROW(uq,LAMBDA(a,MAX(0,COUNTIFS(A2:A10,">="&a,A2:A10,"<"&EOMONTH(a,0)+1)-5)))))

using multiple IF statement with 3 conditions

Date in = when order comes in
Due Out = "Date in"+ 14 days
Today= "today's date" to determine "Current Status" where i have put IF formula:
IF(Due out<Today,"Over Due,"Current")
Over Due Days= =IF(Current Statues="current","0",Today-Due Out)
Actual Out= Date when order went out/completed
i am stuck at:
Once the order is completed, Is it possible to replace "Over Due Days" (which is showing days overdue based on today's date) with "Actual Out"- "Due Out" ( to show the total delayed days which is the final status).
not sure if have explained it correctly, your help will be much appreciated - this is more related to how to put logic.
Would be easier with actual cells references, but try this in Over Due Days cells:
=If(IsNumber('Actual out'),('Actual Out'-'Due Out'),IF(Current Status="current","0",Today-Due Out))
This checks if there is a number in your Actual Out cells and if not uses the if statement you already had working for you.
You could use Data Validation to ensure only Dates are entered in your Actual Out.
I dont know if I get you right but i think this might be a solution:
=IF(ISBLANK('Actual Out');TODAY()-'Date In';'Actual Out'-'Date In')
This formula calculates the "Over Due Days" with the current as long as the order isnĀ“t completed and calculates the "Actual Over Due" as soon as the order is completed.
It uses the 'ISBLANK' function to check if there already is a date when the order was completed.
Based on the Result the formular calculates with either the current date or the date that was insertet.
Hope I could help.
From what I understood from your question, I have came out with the below. Check and let me know if this is what you are looking for. Actually, you can remove the row "Over Due Days", as it is shown in the row "Current Status"

Using dateRestrict to determinate new cases weekly

I'm trying to get 2 date limits from date restrict to calculate the difference between them.
So for example, I get January 1 and January 7, and subtract the second result from the first one.
Theoretically I should end up with the amount of new references to the given searched words in the week, right?
The thing is, sometimes I get a negative result for this, like -60000. How come 60000 references could disappear from one week to another?
Am i misinterpreting the way dateRestrict works?
my url so far is like:
first query:
https://www.googleapis.com/customsearch/v1?q=MYSEARCH&dateRestrict=d209&key=MYKEY&cx=MYID
second query:
https://www.googleapis.com/customsearch/v1?q=MYSEARCH&dateRestrict=d203&key=MYKEY&cx=MYID
The field of the response I'm using is the totalResults.

Trying to calculate the difference between two dates

I'm trying to calculate the duration between when an item is created and the last time it was modified. I'm not sure what's wrong with my formula though because the equation is saying there are 41XXX days when it should be 3. This doesn't happen for all items though, only certain ones.
=IF(DATEDIF(Created,Modified,"d")>1,DATEDIF(Created,Modified,"d")&" days ",DATEDIF(Created,Modified,"d")&" day ")&TEXT(Modified-Created,"hh:mm:ss")
SharePoint seems confused as it is displaying the numerical (integer) representation of 8/18/2013 (US) which is 41504. Your formula displays a result directly in Excel, although the days difference is 2, not the 3 that it displays.
You might simplify it with:
=TEXT(Modified-Created,"d ""day(s)"" hh:mm:ss")
which in Excel displays
2 day(s) 17:34:00
I am not able to test it from SharePoint though.
I suppose if you really want to display either day or days then you might try:
=TEXT(Modified-Created,"d ""day"""&IF(VALUE(TEXT(Modified-Created,"d"))>1,"""s""","")&" hh:mm:ss")
This could possibly be simplified (if SP can cope) to:
=TEXT(Modified-Created,"d ""day"""&IF(Modified-Created>1,"""s""","")&" hh:mm:ss")

find average of calculated field in cognos 10.1

I have a calculated field a/b which makes sense at week level, where a is last of period metric and b is sum of the period metric. I need to find avg(a/b) for the weeks that fall under a month and not end_of_month(a)/sum(b) for the month. I made my a/b metric with regular aggregate as calculated and then monthly average metric with regular aggregate as average, but it doesn't work. The report is a crosstab report. How can I solve this?
Edit: a is end on hand inventory, b is sales, a/b is weeks of supply. Both a and b spread along product/location/time dimensions. For a, I've set its regular aggregate for time as last.
Your form of expression gives me error, so, I tried average((total([a] for [week]))/(total([b] for [week]))) which is error-free but doesn't give correct result. I used total[a] because it still has to sum along other dimensions except time. Any ideas?
I was also trying an alternative way- get the individual weeks of supply and then derive a new metric as (first week wos + ...+fifth week wos)/5. But I get a warning when I try to put a case statement as "Relational query objects are being used in conjunction with Dimensionally-modeled relational objects", and the metric give garbage value. How can I apply case involving relational item in query items of measure dimension?
You have to be more clearer on what you are trying to achieve.
Also, the header says framework manager, while you are talking about report.
My best guess is you need to use the for expression in your aggregate the values:
avg((max([a] for [week]))/(sum([b] for [week])))
You might need to use other (more sophisticated) summary function
for more details about the FOR and AT look here:
Using the AT and FOR Options with Relational Summary Functions

Resources