Create a calculative parameter and display it - tableau-api

How to calculate the fields as per screenshot --> store it in parameter --> display the params in Dashboard ?
I created the parameter A1,A2,A3 and A4.
Even tried to create the calculated field but didn't have success .

Related

Tableau hide parameter header when parameter value is "hide"

I have a tableau table that looks like below
Here, I have created 3 parameters (and corresponding calculated fields).
a) Level_1_selected_dimension
b) Level_2_selected_dimension
c) Level_3_selected_dimension
Each of the parameter has a value called hide which is to turn off the drilldown.
For example, user can choose values for Level_1_selected_dimension and Level_2_selected_dimension but decide to not select any value from 3rd parameter (Level_3_selected_dimension). Hence, the value is set as hide for 3rd parameter as shown below
But the problem now, the header for 3rd level is still shown/displayed in tableau as shown above in my post?
How can I turn off the header/hide the header for 3rd level (as value for 3rd level is hide)?
I expect my output to look like below
In order to achieve this, we need to create another parameters for labels to hide and show the Level 1,2,3 value for example if Level 1 ='hide' then ' ' else Level 1 and use this parameter as Label instead of original dimension. There is no direct way to hide the columns in tableau.

Add filter/parameter in calculated field tableau

I'm trying to create calculated field in tableau, my below query is showing valid, however I want to give filter or parameter to it. For ex: I have a field called Account number and I want my below query to show sum of all the quarters revenue on account number level.
Sum(If ([Qtr]='2019-Q1' OR [Qtr]='2019-Q2' OR [Qtr]='2019-Q3' OR [Qtr]='2019-Q4')
THEN FLOAT([Revenue]) END)
Your logic will work.
For parameter: Create a parameter with String data type, add all field names to it. Then create a calculated field based on the parameter list. Add that calculated field to row shelf then change Parameter, the above formula will be recalculated.
For Filter: You can add filter directly.
1st option:
Add Account number as row in your worksheet
Create a Parameter String with values: 2019-Q1, 2019-Q2, 2019-Q3, 2019-Q4
Update your calculated field to:
If [Qtr]='Parameter Value' THEN FLOAT([Revenue]) END
Add this field as text and the value of sum will be for only that Qtr period
2nd option:
Add Account number as row in your worksheet
Create a Parameter String with values: 2019-Q1, 2019-Q2, 2019-Q3, 2019-Q4
Update your calculated field to:
[Qtr]='Parameter Value'
Add this field to the filters and the whole worksheet will filter on that Qtr period
You can also add another parameter for the year to be more flexible on the years

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.

How to refresh data when we add an option to an tableau parameter?

I have a Tableau report that has a parameter. I added a new calculation to the parameter. But when I try to refresh data on the report (upon clicking my new option in the parameter list) it doesn't refresh data in the report.
If you're using a parameter in order to filter data on your worksheet, then it must be part of a calculated field (that is then used as a filter) or used directly within a Top N filter as follows:
Using Parameters in Calculated Fields
Using Parameters in Filters