Tableau Dashboard Default set to Yesterday by using Date Parameter - tableau-api

I have created daily dashboard which shows the data for single date selected from DATE PARAMETER (with ALL value). Which is OK for me that I can see the data for any date I want.
But the problem is when I open my dashboard it is showing data for date which I selected in date parameter while publishing the Dashboard to Server/Online and Instead of that I want set it default to Yesterday.
i.e. when I open my dashboard first time it should show yesterday's data and also there should option to change date as well to see another date data.
Can we achieve this using DATE PARAMETER (with ALL values)? If it is not possible then is there any other way?
Please Help!

Use a relative date filter instead of a parameter. Just be sure to save and publish the workbook with Yesterday as the relative date value.

1, Create a calculation field d_yesterday, formula is TODAY()-1
2, Create a parameter, data type is Date, value when workbook opens set to d_yesterday
3, use the Date parameter in other calculations fields, or insert parameter into custom SQL query.

Related

change date format in SSRS report dynamically

I am trying in D365 to create a dynamic date format, that is based on the preferences of the user. There is a field "Date, time, and number format" and based on the value of this field, the date format has to be changed. The field on the SSRS report is for some other purposes string, created by some values and one date field, so I would like to ask, if there is any function, that would in a code change the date format based on the user's preferences.
Many thanks for any advice

How to convert a field with 202008 to a date in Tableau

I am trying to convert a field that contains strings such as 202008, 202108 to a date field. I have tried the date() function, clicking on the measure and converting it to a date. I have also tried DATE(LEFT([Month],4)+"-"+RIGHT([Month],2)+"-01") but that will only return the year.
Using Tableau Desktop 2021.1, when I change the data type from String to Date, Tableau translates the strings to 8/1/2020 and 8/1/2021. If you are using an earlier version of Desktop, it is possible that this functionality is not present.
However, if changing the data type isn't working for you, the calculated field code you provided should actually work, you just need to change the date part from Year to Month/Day/Year using the Custom date part option.

How to default variable (list of dates) to current date?

For some dashboards we have a date variable to pick a date from a list of dates. The dates are queried from an elasticsearch datasource.
In our case it would be great if we could somehow set the default value to the current date.
We are using Grafana 7.1.1. I am not sure if it can be achieved at all - Currently I am thinking about extending the elasticsearch-query to put the current date on top but I don't think Grafana can set the default value based on the index.
Another idea is to use a "global" date variable for the current date which I can search for in the variable selection field and then save the dashhboard.
Any hints (including feasibility) are appreciated.
Correct, make current date first in that variable list and never Save current variables -> Grafana will preselect first value from the variable list in this case.
If you already have some saved current variables, then you need to edit dashboard model manually (export dashboard json/edit json - variable definition/import dashboard json).

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.

Crystal Reports default value for parameter

I'm attempting to make the parameters for a Crystal Report more user-friendly for a client, who has requested that they be able to have the default values for a Start and End date parameter be the first and last day of the previous month.
I know how to use either a formula in CR or a stored procedure to produce these values, but I want to know if a variable can be used in the 'Default Value' setting for a parameter, or if it only allows for static entries. Does anyone know? Right now the user can set the date parameters to null and the stored procedure generates the data for the previous month on its own, but I thought it'd be nice if the date parameters actually displayed the dates that were being used as defaults. Thanks in advance!
You can do it, Try below process:
Create a parameter ?date with String datatype and take static and write two default strings as below:
First day of previous month
Last day of Previous month
Now go to record selection formula and write below code:
if ({?date}="First day of previous month") then
table.date=DateSerial(year(currentdate),Month(Currentdate)-1,1)
else if ({?date}="Last day of previous month")
then
table.date=Cdate(DateAdd("d",-1,DateSerial(year(currentdate),Month(Currentdate),1)))