Range aggregation on date_range field - elasticsearch

I have a set of documents with date range. I want to get schedule with in specific duration.
For example, following are 2 events.
1. Event 1 - from 10th to 20th
2. Event 2 - from 15th to 25th
Get schedule from 1st to 30th. Expecting following output.
1. Date 10th to 14th - Event 1
2. Date 15th to 20th - Event 1 and Event 2
3. Date 21st to 25th - Event 2
Please suggest how can i achieve this.

you can use the range datatypes to support this. See this introduction blog post

Related

Show value from last day of the given month - SSRS Report Builder

In a Report Builder table I have to show the value from the last day of the given month, when the month is not expanded.
When the month is expanded, the dates have to show the specific value for that day.
Example is January with values 1 to 31 (same as the day numbers):
When January is expanded, it has to show value 1 on Jan 1.... value 15 on Jan 15... value 31 on Jan 31.
When contracted (and the table only show one row for January), it should show the last day's value of 31
Some months do not have values on all days, so the formula just need to take the last value of that given month
When I use the formula "Last()", then it works half of the time, while for some months, the value extracted is the 3rd or 4th last day of the month - do you know what is wrong here?
Hope above makes sense, and thanks for help.
I think I fixed it my self:
Using Last () formula
Learning how to make a sort order in my Union All dataset, so it came out in the right way
How to give points to my self?

DHTMLX Scheduler recurring year events - Problems with rec_type

I'm trying to add a recurring event in my Database using dhtmlx scheduler. I'm using a full customized Lightbox with my own fields. Daily, weekly and monthly Events will be added perfectly to the database. Maybe i overlooked something
I've tried to save the exact rec_type like the monthly event, because they are using the nearly the same template, there is only one difference between them. I changed "month" into "year".
At the end, my entry looks like this:
{
end_date: "09.06.2026 12:00"
id: "a97ede9d-372f-4360-9fdb-e97e26aaacf8"
rec_type: "year_5_4_1#09/06/2026"
start_date: "05.09.2019 12:00"
text: "test12345"
}
I expect the output of all events on the first thursday in may until 2026. Maybe you can help me to find out, where the error is.
If recurring events start in May, the start_date also must contain May. I.e.
start_date: "05.05.2020 12:00"
The client side gets data from the rec_type field as a string of the following format:
[type]_[count]_[day]_[count2]_[days]#[extra]
where:
type - the type of repetition: 'day','week','month','year'.
count - the interval between events in the "type" units.
day and count2 - define a day of a month ( first Monday, third Friday, etc ).
days - a comma-separated list of affected week days.
extra - extra info that can be used to change the presentation of recurring details.
So, rec_type for each first Thursday in May must be:
rec_type: "year_1_4_1_"
Demo to check how it works.
If you need more details about rec_type property, please find them in docs.

SSRS Report Expression to display Weekly, Monthly and YTD totals

Have a report that displays daily counts and dollars. I'm trying to additional columns to display weekly, month to date and year to date totals.
In the past I've done this by creating separate weekly, monthly and ytd data sets and then used lookup expressions to populate the fields. Is it possible to use expressions that reference my primary data set, which includes a date column, to get weekly, mthly and ytd totals?
If this is possible, I'm not sure how to write the expressions to:
look back at the past 7 days and get totals for those days
Get totals for the current month
Get YTD totals.
Any help that anyone can provide would be appreciated. I've attached an example of the report I'm trying to create.
Thank you.
You would just need to use an expression for each as a filter your Dollar Amt column. It will determine whether to add the dollar amt or a 0 for each row of data.
I assume that you have a date field - I'll call it DATE.
YTD
=SUM(IIF(YEAR(FIELDS!DATE.VALUE) = TODAY.Year, FIELDS!DOLLAR_AMT.VALUE, CDEC(0)))
Monthly
=SUM(IIF(FORMAT(FIELDS!DATE.VALUE, "yyyyMM") = FORMAT(TODAY, "yyyyMM"), FIELDS!DOLLAR_AMT.VALUE, CDEC(0)))
The weekly would be a little different and depend on your week (sun - sat, mon - sun...) and your first day of the week setting but you get the general idea. If your using Monday - Sunday maybe something like:
WTD
=SUM(IIF(FIELDS!DATE.VALUE >= TODAY.AddDays(1 - TODAY.DayOfWeek), FIELDS!DOLLAR_AMT.VALUE, CDEC(0)))
The CDEC is used to add the 0 to the dollar amounts - otherwise you'll get an error when it tries to add 1.25 + 0. It's to Convert to DECimal.
The same logic will work for the counts - just use the Unit_Count field and remove the CDEC conversion for the zeroes.

Get Week Number of the year with custom day as starting day of the week

I want to use Date.WeekOfYear() Function to get Week Number for datetime values, but with a custom day as the start of the week (Let's say Saturday rather than Sunday). How is it possible in PowerQuery M?
You could use a conditional statement like this (adding 1 to the weeknumber if the day is saturday):
if Date.DayOfWeek([Date])=5 then Date.WeekOfYear([Date])+1 else Date.WeekOfYear([Date])

Drupal7 Views: Grouping by Date Over a Range

Creating a view of events over time. Some events are one day events - some stretch over multiple days. Some are repeating events. What I would like to do is create a view that shows all the events for day 1, then for day 2, and so on.
For example:
Event 1 - happens every Monday in May
Event 2 - happens the first full week of May - 5/5-5/11
Event 3 - happens Tuesday May 7th
So the View would show:
Monday, May 6th
- Event 1
- Event 2
Tuesday May 7th
- Event 2
- Event 3
Wednesday May 8th
- Event 2
And so on. Any suggestion on how can I group to create this? Or do I need to alter the file?
Use Drupal Calendar: http://drupal.org/project/calendar
It automatically creates views in days, weeks, months, etc.

Resources