Kendo grid group datetime column only on date - kendo-ui

I have a few datetime columns in Kendo grid in an ASP.NET MVC application. When grouped on any of them, the groups are segregated and displayed for same dates as they have different times.
I want to group them based on date only and ignore the time part. The column should still have the values in datetime format only.
I could display the group headers as Date only by using .ClientGroupHeaderTemplate("#= kendo.toString(value, 'MM/dd/yyyy') #") in the column definition.
Can something similar be applied while grouping?

Related

Formatting and Sorting a Kendo Grid Column differently

For view purposes I am formatting the date values in my grid and that seems to be fine.
The problem is my column is also sortable and my custom date formatting is messing up the sorting. If I sort by real values from database, the sorting is fine but then I lose the ability of custom formatting the date for view purposes. So I wanted to see if there is a way to tell it format it like this but sort it some other way?
Here is how I format:
obj.Item.CustomFormattedDate = kendo.toString(kendo.parseDate(obj.Item.RealDbDate, 'yyyy-MM-ddTHH:mm:ss'), 'MM/dd/yyyy hh:mm tt');
and then in my column definitions I setting my column to that field CustomFormattedDate which is good for viewing but BAD for sorting. If I switch my field to be the actual RealDbDate values, then sorting becomes good but viewing becomes bad!
I'm doing exactly what you're looking for. I'm using the ASP.NET Core wrappers for Kendo and set up the column like this:
columns.Bound(p => p.ShipDate).Format("{0:g}");
Ship Date in the model is a DateTime, the sorting works, but then I can make that format string any of those listed here https://docs.telerik.com/kendo-ui/globalization/intl/dateformatting

How to create a measure in Power Bi dax which is to be related to Date Column in matrix

I want to make the following table with such data:
Columns: Dates from the selected week(based on calendar table) in WeekMonth slicer
Subcon: Subcontractor distinct list, created with power query from the Subcontractor values in the data table
Plan and Actual: count of set dates, which were set in the data table which looks like:
siteid, subcontractor, milestone, plan date, actual date
Milestone slicer allows to filter data table for a specific milestone and is linked to datatable[milestone]
WeekMonth slicer allows to filter data table for a specific week, only one week can be displayed in the table, by default the "current week is selected".
Filtering data table using the Relatationships between the Calendar[WeekMonth] and the data table is not possible because it contains two types of dates.
As I understand the DAX measures for Plan and Actual must be designed in a such way so it would refer to the date from the matrix Column. How this can be implemented?
How the table must look like(values are not correct yet!):
"Filtering data table using the Relatationships between the
Calendar[WeekMonth] and the data table is not possible because it
contains two types of dates."
It is actually possible to filter multiple date fields by one calendar table in Power BI.
The way it works:
Connect your Calendar table to plan date field;
Connect the same Calendar table to actual date field. Power BI will add this second relationship as "inactive", as indicated by the dotted line;
Normally, when you use your week slicer, it will filter DAX measures by the active connection only (plan date). However, you can tell DAX to filter by the inactive connection instead, using USERELASHIONSHIP function.
Code typically looks like this:
Metric by Plan Date = SUM(TableName[Field])
Metric by Active Date =
CALCULATE( [Metric by Plan Date], USERELASHIONSHIP(Calendar[Date], TableName[Actual Date])
Here, you first define your DAX measure normally, and it will calculate using Plan Date. Then, you recalculate the same measure using different relations (Active Date).
This article might help you further:
https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in-power-bi

Sorting behavior incorrect with FormatDate

I am editing a Webi report using SAP Business Objects BI4.
I have a report with a table in which I display a date formatted like this :
=FormatDate([Sales Date];"dd-MMM-yyyy")
Originally, Sales Date dimension has the format "mm/dd/yyyy".
I want to sort my table by this formatted date dimension in ascending order, so I just select my table > right click > select Sort and then I select the =FormatDate([Sales Date];"dd-MMM-yyyy") in ascending order.
My problem is that, the sorting behavior is incorrect as the result is as follows:
Sales Date
----------
01-AUG-2006
----------
01-JUL-2010
----------
02-FEB-2006
----------
03-AUG-2005
As you can see above, it seems that the sorting is only done by the "day" value and it completely ignores the "month" and "year".
My object is correctly defined as "Date" in the universe.
and the sorting is correctly done when I don't use the formatting "dd-MMM-yyyy" and keep the original format of Sales Date.
Any suggestions please?
Thanks!
The return data type of the FormatDate is a string. This is why the sorting will be out of order as it will sort the string value instead of the date value.
You have two options:
Format the date using a (custom) date format (In the Formatting section when you have the document in Edit mode). You'll need to use the RIA (Java applet) in order to define your own custom date format. Alternatively you can use one of the formats available. This will not change the data type but only the presentation, thus the sorting should be fine.
If you still want to use the FormatDate option, you could add the [Sales Date] in a second column, use it to sort your data and then hide the column.

Excel Pivot Table - Date Range Filter with Filter Dimension

I have a date dimension in the FILTERS part of an Excel 2013 Pivot Table.
I want to easily filter for all the dates in a range but i have to check and uncheck tons of checkboxes while i would like to just specify two dates. I can do this when the dimension is in the ROWS but i can't understand how to do the same in filters.
Have you considered using a Timeline filter instead of a regular filter or slicer?
You just need to have a field that is a date. Use it to create the timeline (on the Insert tab in Excel, choose Timeline). Then you can select the level/time period (date, month, quarter, year) at which you want to create your date range and click and drag to create the range. More details are in the link.

How to query only by month on date input and ignore the year and day considering indexing or performance on database in laravel

I have this table
training_schedules
id
course_reference
start_date(date)
end_date(date)
year_id(int, fk)
on my form, I have dropdownlist for the month, and another one for the year.
Now as you can see there is a mismatch on the month from form and database column. How can I filter the start_date or end_date column using only the integer value from the dropdownlist and ignore the day and year part of the db column?
I saw some examples but using raw query and using date functions of database which is not good if you consider performance because it is not indexable.
Can I achieve this using Eloquent/Fluent Api of Laravel?
If you are using mysql
u can use the month() function to get month from date
For further clarification please visit the link

Resources