From the Distribution list of users need to get the list users who are going to complete their work anniversary in the next month using filter. Able to get the users employee hire date need a filter for the Employee hire date property based on the month so that instead of pulling all the users specific group of users i can fetch
Unfortunately, you can't filter employeeHireDate by year, month or a day.
You need to send several requests to get all data you need. For filtering by employeeHireDate you need to add header ConsistencyLevel:eventual and query parameter $count=true
Get users with one year anniversary in the next month
https://graph.microsoft.com/v1.0/users?$select=displayName,employeeHireDate&$filter=employeeHireDate ge 2021-12-01T00:00:01Z and employeeHireDate le 2021-12-31T23:59:59Z&$count=true
Similar for users with 5, 10, etc. years anniversary
https://graph.microsoft.com/v1.0/users?$select=displayName,employeeHireDate&$filter=employeeHireDate ge 2017-12-01T00:00:01Z and employeeHireDate le 2017-12-31T23:59:59Z&$count=true
https://graph.microsoft.com/v1.0/users?$select=displayName,employeeHireDate&$filter=employeeHireDate ge 2012-12-01T00:00:01Z and employeeHireDate le 2012-12-31T23:59:59Z&$count=true
Related
I have a users database for user sign up time:
id, signup_time
100 2020-09-01
001 2018-01-01
....
How could I find monthly existing user for all the history record? Use the last day in the month as the cut off day, existing users means if I observe in July last day, 2020-07-31, this user had already signed up before 2020-07-01. If I observe in June last day 2020-06-30, this user had already signed up before 2020-06-01.
Similar as a for loop in other language:
observation_year_month_list = ['2020-04','2020-05','2020-06']
for i in observation_year_month_list:
if user signup_time < i:
monthly_existing_user_count+1
While PL/SQL has loops, that is a procedural language extension. SQL is a declarative language and does not use loops. Instead, you describe the results you want and the database comes up with a query plan to make it happen.
Your case is handled by group by to aggregate rows into groups. In this case by month using date_trunc. Then you use the aggregate function count to count up how many users are in each group.
select
count(id) as num_users,
date_trunc('month', signup_time) as signup_month
from users
group by date_trunc('month', signup_time)
I'm building a local database in Access 2010 from reports of customer accounts that need demographic information searched. Each week a new report is generated and the results are added to the list, however there is duplication each week in the listing for those accounts that have not been found yet. I have been able to create queries that will display accounts that have only shown up on one report, and queries to display accounts that show up on multiple reports. But I am trying to now create a query that will show when an account was first added to the listing.
The columns I am looking at would be named similar to this:
accountNum - account number
custName - name of the customer
reportDate - the date that the account was pulled to be searched
The end result would be a table that shows all the accounts that (for example) appeared on multiple reports, but appeared first on December 1st, Dec 8th, Dec 15th, etc...
Thoughts?
This is an aggregation query:
select accountNum, custName, min(reportDate)
from reports
group by accountNum, custName;
This should get you a list of all of the accounts that appear multiple times along with the first date that they were reported.
SELECT
accountNum,
custName,
MIN(reportDate) AS firstReportDate
FROM
MyTable
GROUP BY
accountNum,
custName
HAVING
COUNT(*) > 1
I make a database for theatre tickets selling system. There are tables with theatres, spectacles and sessions of spectacles (one spectacle can be showed many times). In table with sessions there is a date field. I need to make a form, where user can choose a theatre and a month, and will get a report with a list of sessions in chosen theatre for chosen month. Does anyone know how to do it?
i guess you are searching for the Month Function.So when you select a month you need to perform this on the query :
WHERE Month(DateOfSession) = " & me.cboSelectMonth
I'm currently working on a project in which I want to aggregate data (resolution = 15 minutes) to weekly values.
I have 4 weeks and the view should include a value for each week AND every station.
My dataset includes more than 50 station.
What I have is this:
select name, avg(parameter1), avg(parameter2)
from data
where week in ('29','30','31','32')
group by name
order by name
But it only displays the avg value of all weeks. What I need is avg values for each week and each station.
Thanks for your help!
The problem is that when you do a 'GROUP BY' on just name you then flatten the weeks and you can only perform aggregate functions on them.
Your best option is to do a GROUP BY on both name and week so something like:
select name, week, avg(parameter1), avg(parameter2)
from data
where week in ('29','30','31','32')
group by name, week
order by name
PS - It' not entirely clear whether you're suggesting that you need one set of results for stations and one for weeks, or whether you need a set of results for every week at every station (which this answer provides the solution for). If you require the former then separate queries are the way to go.
I am developing a cube with Analysis Services 2000 for a web application where users can register and unregister to the site. So, the "user" table has these three fields:
activo (1 or 0)
fechaAlta
fechaBaja
When the user activates his account, the application saves the "fechaAlta" and puts 1 on "activo" field.
When the user unsubscribes his account,the application updates the field "activo" to 0 and saves the "fechaBaja".
The information I need is to know how many users are active at a time, through a time dimension. Something like:
Year Month Day Active users
2009 January 1 10 (10 activations this day)
2009 January 2 12 (3 activations this day and 1 unregistered)
2009 January 10 17 (5 activation this day)
Even I query on february 2009, I need to know that in January 1th there was 10 active users (the user that unsubscribed the 2th must be counted).
I developed a cube where the fact table is the user table, and create two dimensions for both date fields (fechaAlta and fechaBaja). Also I created this calculated field:
active by month:
Calculation subcube: {[Measures].[Altas]}, [Fecha Alta].[Mes].MEMBERS
Calculation formula: sum({Descendants([Fecha Alta].currentmember,[Fecha Alta].[Día])},[Measures].[Activo])
active to day:
Calculation subcube: {[Measures].[Inscritos]},[Fecha Alta].MEMBERS
Calculation formula: sum({Periodstodate([Fecha Alta].[(Todos)])},[Measures].[Activo])
I don't know how to discount the unregistered users only from the day indicated on fechaBaja.
Thanks.
This is a classic slowly changing dimension issue. What you are describing is a type 2 slowly changing dimension see here
You need to make sure that your user dimension has a surrogate key. Then you create a new record in your user table each time the user changes status and then you use effective dates to control which surrogate key to insert into your fact table. This will let you report on the users effective status at any point in time.
I think you need a "User Status" dimension, then you can show this against Time, with the measure being count of users.