Grafana, how to transform time column from timestamp to date - grafana

I am trying to use transformation "Convert field type" to strip time from timestamp,
but it seems not to work as I expect. Any idea how to get rid of time?
I need only date in order to group by day

If you just want to have a single line per day, you can use GROUP BY time(1d) in your query.
To hide the time part inside of the label, define an Override:

Related

Dynamic Temporal Control with both: aggregate date and time in QGIS

I have a data frame with both, dates such as 2021-01-01 and times such as 11:38:17. The frame consists of 1.000 cells.
I would like to use the dynamic temporal control function to show data at a given point of date and time of day.
Unfortunately I can only animate the day. As soon as I want to change the step towards hours, I face to problem to tell QGIS where it can find the time of the data set.
Which query can I use to aggregate date and time to one column?
Thanks in advance
Use the function concat in the field calculator as follows:
concat("date", "time")
"date" — field with years and months; "time" — field with time.
In the description of the function you will see examples.
Maybe combining the columns will not be enough. To do this, you need:
Resave the layer in GeoPackage or GeoJSON (SHP does not recognize the date and time together).
Create a new field with a date and time value as follows (in the field calculator too):
— select the type of the new column "Date and time";
— in the field with the expression, write the name of the combined field. For example, "datetime".
If I understood the question correctly, then the method is.

DAX and FORMAT function

i have a field for date with date, month and year.In my visualization, I need date to be displayed in (MON-Year) format.
I switched to data view, created calculated column with
Mon-Year = FORMAT('table'[Date],"YYYY-MM")
Now it's getting displayed as (YEAR and Month number) but I want to change it as month name.
After changes in data view, when I close apply, the column is present but there is no data type visible.
Should I create different calculated fields for year and month separately and then concatenate it?
any help would be appreciated.
If you want month first, then maybe you should specify it that way.
Mon-Year = FORMAT('table'[Date],"MMM-YYYY")
This may be useful for you:
https://learn.microsoft.com/en-us/dax/custom-date-and-time-formats-for-the-format-function

The group options for a date, time or date-time condition field must be a date group

I'm using VS2017 and trying to convert my reports from Delphi to Asp.Net, but the problem with some until this point that My users can change their sort from the GUI and I need to dynamically adjust the sort in code to match their selection.
To do this I use the following code:
ReportDocument.DataDefinition.Groups[i].ConditionField = ReportDocument.Database.Tables[CrystalReportDatasource].Fields[cField];
However if cField is aDateField and the original is a StringField group I receive the following exception:
The group options for a date, time or date-time condition field must be a date
group options object crystal reports" when I try and excute the above
statement.
Any idea how to fix that?
When you group on a date, Crystal needs to know what type of date grouping you wish to apply (e.g. Every Day, week, or Month...).
You need to take care of that aspect in code or simply create a String formula to convert the date column to a string and Group on that formula instead of on the raw date column.

SSRS Preset or Custom Date Selection on Report

I currently have a report with the ability to select a start and end date. I was curious if you could make have both preset and the option for a custom selection
Selection:
Current Week, or
Previous Week, or
Custom Date Range.
Thanks,
Take a look at cascading parameters.
The link above seems to focus more on getting your cascading parameter values from a query, but you probably don't want that for a date - as far as I am aware, setting Available Values for a date parameter limits you to a dropdown list of dates, instead of the calendar which is generally easier to use. It is still a good background on how cascading parameters work though.
To do this with expressions for the default start/end date, you would basically want the first parameter to be a choice between "Current Week", "Previous Week", and "Custom Date Range". You would display those labels to the user, but the values can be whatever you want - for my test I just used 1, 2, and 3.
Then, you would set up 2 more parameters, one for the start date and one for the end date. Make sure the data type is Date. You will want to set up default values for these based on the value of the first parameter. I would do this with an expression such as the expression below for the start date. You also may need to modify this a bit depending on how you define the week - is the "Current Week" just the previous 7 days, or is it the latest Monday through today, or something else, etc.
=Switch(
Parameters!FirstParam.Value = 1, DateAdd("d", -7, Today()),
Parameters!FirstParam.Value = 2, DateAdd("d", -14, Today())
)
In this case, you don't even need to account for the 3rd option, because if the user wants a custom date range then you do not want the start and end date to fill in with any default values. You would need a similar expression for the default end date as well.
Since you want the user to be able to enter a custom range as well if they were to select the third option, you do not want to fill in the Available Values for the start/end date parameters, as the user would then not be able to select any date (at least as far as I am aware - if there is a workaround to that, I would love to see it, as that would be something I would like to use myself).
A possible downside to this approach is that if the user begins by selecting Current Week and then changes their mind to Previous Week, the start/end dates will not change to the Previous Week. You can read more about why this happens here, but essentially: since the values that are already filled in after selecting Current Week are still valid (they are dates, which is the only criteria for those parameters since no available values are set up), they will not refresh after changing the selection. The fix for this is to define the Available Values, but as mentioned above, this will then stop the user from entering a custom date range.

Tableau Using Parameters for a Date Selector

I've been looking into making a date selector so instead of filtering by Month, Week by adding filters then displaying the quick filters to correspond. I want to be able to dynamically change the date so I can choose between Quarter, Month and Week in a single drop down.
I have made the selector part no problem it shows but when I come to my calculated field, it's not behaving how I would like.
Here is my calculated field:
CASE [Parameters].[Date Select]
WHEN 'Quarter' THEN QUARTER([Date])
WHEN 'Month' THEN MONTH([Date])
WHEN 'Week' THEN WEEK([Date])
END
This gives 2 errors...
Unknown Function QUARTER called
Unknown Function WEEK called
I am puzzled because the month one is fine.
Normally in tableau to get the month/quarter/week, I click on the Date dimension and select Month or week and it filters and displays like so: MONTH(Date).
Can anyone tell me where I'm going wrong and how I can pull the week and quarter from date in the calculated field so my selector will work.
Thanks.
There are no QUARTER and WEEK functions in Tableau, as you can see in the image below.
What you should be using to get these values are:
DATEPART('quarter',[Date])
DATEPART('week',[Date])
For filtering the date using your parameter as filter, I'll assume that you want to filter the current quarter, month or week. In this case you'll need to setup your paramaters like this:
Then you'll create a Calculated Field with the following formula:
DATEPART([Date Selector],[Date]) = DATEPART([Date Selector],TODAY())
This should give you a True/False dimension which you will use as filter for the value True. After that you should have a working parameter filtering your data accordingly to the value set.