Tableau set default value in the filter - tableau-api

I have a gender of a person and i want to create such filter
How can i set deafault "men" value in this filter?
When user select another value and then deselect value i need to
return default value in the filter
I've already tried to create such a calculated field, but it does not work with
MIN({FIXED: COUNTD([gender])}) <> MIN({EXCLUDE [gender]: COUNTD([gender])}) OR MIN([gender])="men"

There are several tutorials about creating a default value for filtering (and several different techniques), one of them is this one: Dynamic Parameters, Default Values and the Flexibility to Choose
For me, if you just have to put "men" as default (I mean, not a calculated value, like today's DateTime), you can just filter man before publishing your dashboard to Tableau Server/Tableau Online and every use that navigates your content will find this value selected.

Related

Tableau KPI prev value depending on variable

am trying to get Previous Sum(of someField) based on a variable value which is an Id.
This is not a table, Im doing a KPI
On Qlik you would do something like:
SUM({<Id={"$(=Max(vVariable),-1))"}>} someField)
But I can not achieve it on Tableau, off course is due to my lack of knowledge, unfortunatelly time is tinking at work and wanted to see if anyone has any input!
Thanks
Assuming you may use a sample input like the Superstore (using sales as metric), this could be what you're looking for:
In red you can see your "variable" which allows you to select a value and in blue you'll find the unique row for the previous value (Order ID sorted).
The first thing you need to to do is creating a parameter based on all the Order ID values:
Then things start to get a bit complicated if you're not familiar with LOD (Level of details) and the order of execution in Tableau, especially for filters.
Assuming that you can get some information on your own (otherwise, feel free to ask), the first thing you nee to to do is to "pre-calculate" the equivalent of a table having a rowe for each Order ID, in which you also have the previous Order ID value.
You can achive this combining Fixed (LOD) and Lookup function, creating this Calculated Field "Lookup Order ID":
LOOKUP( max({ FIXED [Order ID] : MAX([Order ID])}),1)
This is actually just a calculated field that you want to "fix" because you need the filter to act after you have made that previous calculus, and then you shift your data by 1 row backward.
Once you've done that, you just nee to create another calculated field in order to test your parametric value, and it could be something like this "check param":
[Lookup Order ID] = [Order ID param]
Moving this calculated field in the filter section and selecting just "true" values, you'll get that unique rows like in the initial image, showing the previous value (blue) related to the one you select in the parameter drop-down menu (red).

Filtering Based on a Different Column on Tableau

I'm wondering if something like this is possible.
Assume I have a data table like this:
I want a filter, where user picks France for example, but the data is filtered based on corresponding Continent value, e.g., all Europe records should show up.
Is this possible?
Sure, We can do that. If you add country to Filters shelf, Tableau will show only records of selected value. In our case, if we filter "France", Tableau shows only records which has France. So we will miss other Europe records. Parameter can handle this scenario. Follow below steps.
1.Create a String parameter
2. Create a calculated field
3. Add the created calculated field to Filters shelf then choose 'show'
4. Right click parameter then 'Show parameter control'. So it will works like filter
Method 2: Dynamically change parameter value
Pros: No hard coding, dynamically changes value based on selection. It works, well on dashboard
Cons: You will not have drop down for selection like filter. So, you need to click a chart to trigger the changes.
1. Create a String parameter with allowable values as 'ALL'
2.Create a calculated field
3.Create a parameter action in dashboard.
Dashboard-> Actions-> Add Action -> Change Parameter
In Change Parameter dialogue box, set target parameter as 'Parameter Name' and value field as 'Continent'
4. Add the calculated field to filter and select 'True' on other sheets
5. Final Dashboard looks like
Click the icon on the selector sheet. It will automatically filter data on data sheet.
Inside the selector sheet

Show all parameter values

My parameter field allows multiple values. How can I show all of these values at the top of the report? Currently it only shows one value at a time.
If your parameter is dynamic and takes the form of an array, you'll need to join the values together via a Formula:
Join ({?Parameter},", ")
Activate the Can Grow property for that field. Put this field in a new section so it can easily grow based on your content.

Tableau - Filter/Parameter For Different Date Ranges

I am trying to set up a filter or parameter for different date ranges in Tableau, such as:
Previous Week
Previous 4-Weeks
Previous 8-Weeks
based on the most recent data in the database. Is this possible?
Edit:
I should have been more clear here.
Is it possible to only have these options in the filter and have it based on the maximum date in the database?
Update
Based on your comment and updated question, you can do it as you intend, though it isn't as straight-forward.
NOTE: I did this very quickly and with a random data set, so it will be important for you to test this thoroughly with your data set.
Steps:
Create a parameter control that the users will use to change the selected date range. I created this as a list of strings with values that I can use directly in a calculated (after simple casting):
Create a calculated field that you will use as a filter that references the selection of the parameter control. It tests to see if the difference (in weeks) between the maximum date in the view and the date of any given row is less than the value of the parameter.
Calculation: INT([Date Filter Parameter]) > DATEDIFF("week",ATTR([Date Field]),WINDOW_MAX(MAX([Date Field])))
Place the calculated field in the filter box and set it to True.
You will be able to filter your data like so:
Original Answer
Yup - that is built into Tableau.
Add your date to the filter and select the "Relative Date" option:
You can set the defaults - users can change these later:
Then just "Show Filter":

Dynamic parameters in Crystal report

I have a LINETYPE parameter with the following values:
INV_DEVICE
INV_SIM
TAX
OTHER_ITEMS
If the user chooses anything from the LINETYPE parameter anything that start with "INV_*", is it possible that another parameter field be populated dynamically?
For example, the user chooses INV_DEVICE. There would appear another parameter field called GOODSTYPE.
Values for GOODSTYPE are taken from the database. Example:
PAGER
GSMPHONE
SMARTPHONE
TABLET
But when the user chooses TAX or OTHER_ITEMS the user does not need to choose any value from GOODSTYPE, or the parameter field does not show at all.
The output of the report are those matching the criteria the user entered.
Note that for LINETYPE and GOODSTYPE, user can choose multiple values.
LINETYPE is a mandatory field, but GOODSTYPE will vary upon the values chosen by the user in LINETYPE
What you really want is call Cascading Parameters. The first selection leads to a refined list on the second selection which leads to another refined list, etc. Like Country -> State/Province -> City.
I don't use it but from what I gather, your selection needs to be stored in a table. To create a Cascading Parameter:
Create a new parameter
Under List of Values, select Dynamic
Select your value, description and Paramter
Set the option for Allow Multiple Values
repeat step 3-4 if you have more parameters.