How to find the future date using SQL query? - infomaker

I have over 50K people in my system with their DOB under a tablename as Employee and column_name as Birthdate. i have report to generete to find how many people did actually turned 65 until todays date,and somebody turning 65 in future months ( AUGUST, SEP, OCT and so on). can somebody please help me how would i write that query ?

I'm not a sybase expert, but this should return all employees who are over 65 years as at 01 July 2014
select * from employee
where datediff(yy, Birthdate, "Jul 1, 2014") > 65
Source:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36271.1550/html/blocks/X47295.htm (Google searched for sybase sql datediff)

Related

What type of analysis would fit for this dataset problem?

I have a data set which shows how many cars passed through a carwash through out each September for 2019, 2020, and 2021, by day. So for Sept 2019, it will show 37 cars on Monday the 2nd, 38 cars on Tuesday the 3rd, etc. What I would like to do is use the data for the three years to make a comparison for each day before and after labor day, and see if there is any relevance to the trends in comparison to the rest of the month. Some kind of statistical analysis that might show statistical significance how much change is on those two days versus the rest of the month. How could I go about doing this? Would that include something like linear regression? I'm not a statistics guy so I'm just throwing this out there for someone more knowledgeable.
Here's a snippet of one of those data tables
Date Weekday CarCount
01/07/2019 Mon 37
01/08/2019 Tue 38
01/09/2019 Wed 26
01/10/2019 Thu 46
01/11/2019 Fri 40
01/12/2019 Sat 45

PowerBI Desktop: Cumulative of measures from the start of January to Selected Filtered date

I am looking for a way to get a cumulative count using powerBI dax formulas.
I currently have this measure:
[Tasks opened] = distinctcount(id number of tasks that are open)
When I select the filter month (May 2021), it only shows me the opened tasks in May 2021.
Example - Tasks Opened:
>Jan 21 - 5
>Feb 21 - 6
>Mar 21 - 8
>Apr 21 - 2
>May 21 - 7
>Total = 28
When I select the filter for May 21, I want the measure to show that it is 28 instead of 7, and if I select April 21, I want the measure to show 21.
Help is greatly appreciated! Thank you :)
Elaboration:
Basically I want a method where I will be able to filter the tasks opened based on the date selected on the filter.
When the filter month is May, I want to distinct count the number of incidents that has been open for more than 90 days as of 31 May.
It should change accordingly when the filter month is April, so it should distinct count incidents that has been open for more than 90 days as of 30 April.
It should include all the open incidents (whether it is created in Jan/Feb even though the filtered date is April etc).
I figured it should be like if created date is before filter date, resolution date is after filter date and the incident has been open for more than 90 days, that data should be taken into counter.
--> The issue arise where I cant seem to get the right date for the filter date. Currently I used a measure, but the End of Filtered Date seems to only be the last day of the month (i.e. if filtered month is may, the filtered date will be 31 May 2021).
Open incidents = IF(AND(incident_sla[Created]<=[End of Filtered Month],incident_sla[Resolved]>=[End of Filtered Month]),DATEDIFF(incident_sla[Created date],[End of Filtered Month],DAY),0)
The sample excel file can be found here: https://docs.google.com/spreadsheets/d/1wMLrvfAD1gUUIxljjBgcugJsG4o-w4nE/edit#gid=605277454
P.S. Sorry for the bad formatting, I'm not very familiar with using stack overflow.

Auto - sorting date in microsoft Excel 2016

I'm trying in excel something very simple but the answer seems more difficult?
At work we created an excel file and from left to right we can fill in details.
For example:
Date EmployeeName Status Comments
But I want that all cases are being automatically sorted by date. And then from the date of today and future ( explain this later at second ).
So for example today is 27 march 2020.
Case1: 1 april 2020 / EmployeeName / Status(open) / commments
Case2: 2 april 2020 / Employeename / Status(closes ) / comments
Now I fill in a new date lets say 29 march 2020. This should automatically pop up above 1 April 2020. However you need to manually click on the sorting table.
Second what if there are cases from before 27 march ( today's date ) can you make them disappear to the bottom of the list? Or in another tab in excel?
I believe that the easiest solution would be to write an if(...) statement to fulfill those terms in moving the selected dates. For sorting the dates I would recommend to have the date format in dd/mm/yyyy. So it would read 27/03/2020, instead of 27 March 2020. I find the default sorting of excel to work better with the number sequence in that format when sorting (ascending and/or descending) dates.

Finding the difference in minutes or seconds for two timestamps in excel?

I have two columns in a excel containing value like : Mon Dec 01 09:27:04 2014.
Lets say column A and column B and each column has rows containing values in the above format. How can we find the difference between two dates?
Mon Dec 01 09:27:04 2014 - Sun Nov 30 11:08:36 2014 = 25 hrs 51 minutes
Please see this for how to do that..
A more direct answer: you can format the cell
=TEXT(B2-A2,"h:mm")
I suspect the data is text strings for which I suggest:
=VALUE(MID(A1,9,2)&"/"&MID(A1,5,3)&"/"&RIGHT(A1,4))-VALUE(MID(B1,9,2)&"/"&MID(B1,5,3)&"/"&RIGHT(B1,4))+(MID(A1,12,8)-MID(B1,12,8))
However this relies on Excel's ability to interpret the likes of Dec as the month of December which may not be the case for all language versions. If so, I suggest a lookup table and extracting the dates with DATE along these lines:
=DATE(RIGHT(A1,4),VLOOKUP(MID(A1,5,3),Table,2,0),MID(A1,9,2))
However by such calculation the difference of the timestamps given in the question is:
22 hrs 18 minutes 28 seconds
when formatted:
[hh] "hrs" mm "minutes" ss "seconds"

Adding YTD, YTG column to Excel OLAP Pivot

I have an Excel pivot table connecting to an OLAP cube with a report looking something like
Jan Feb Mar .........Dec
Revenue 55 32 65..........45
I'd like to add extra columns YTD and YTG etc. These are already calculated measures in my cube, but when they are added to the Pivot table, not surprisingly, the months are repeated for each measure.
I just need the columns at the end like
Jan Feb Mar .........Dec YTD YTG
Revenue 55 32 65..........45 654 30
Is this possible?
I've got a solution although an inelegant one. Basically to create calculated members for Jan-Dec and uses these as columns in the report.
As I say, inelegant but client likes it.

Resources