4 Replies Latest reply on Jul 23, 2018 6:32 AM by Naveen B

# Vary dimension value based on selection

Hi People,

In my current project i have a scenario wherein i have to select 3 qtrs based on the selection of max qtr.

Ie., If user selects FY19Q2 as max qtr, i want to display sales of Fy19Q2, FY19Q1 & FY18Q2.

when user selects FY18Q4 as max qtr, i want to display sales of FY18Q4,FY18Q3 and FY17Q4.

In real time I'm connecting to Tableau server data source wherein FY qtr gets updated. I have simulated test data and added to attached worbook. Could someone help me to achieve this scenario.

I want to user to select max qtr from filter only and not parameter as it becomes static if i make it as parameter.

• ###### 1. Re: Vary dimension value based on selection

Hi, Shruthi

The best is to use a date parameter which picks up any date in a quarter stands for the selected max quarter. If this is an acceptable workaround, I can show step by step with your sample workbook.,

ZZ

• ###### 2. Re: Vary dimension value based on selection

hi Shruthi,

use the below approach to get your requirement

Step 1: Create a view with FY QTR and sum(sales) like below by dragging FY QTR to columns and SUM(Sales) to rows

Step 2: Create a String Parameter and add from the field FY QTR

Step 3: Create calculation below to capture the maximum index of selected quarter

Step 4: use the below calculation to validate the Quarter and quarter -1 and quarter -4

Step 5: use the validate quarter in filter and select true

now you will be able to view the report as per the quarter seletion

If user selects FY19Q2 as max qtr, i want to display sales of Fy19Q2, FY19Q1 & FY18Q2.

user selects FY18Q4 as max qtr, i want to display sales of FY18Q4,FY18Q3 and FY17Q4.

Hope this helps, mark this answer as correct or helpful so that it will help others

1 of 1 people found this helpful
• ###### 3. Re: Vary dimension value based on selection

Hi Naveen,

But FY QTR Param is static here. It wont get updated automatically right? Every time we should refresh the parameter by editing it.

-Shruthi

• ###### 4. Re: Vary dimension value based on selection

Hi Shruthi,

Yes parameter are static with filter no way you can get the above approach as far as i know

Consider an example filter you are applying as FY17Q4 your sheet will show only respective selection parameter why we are using instead of filtering data we are using as static value to match with the dimension getting the requirement.

Only approach is with parameter in order to parameter automatically you need go with the javascripting (Check the links below)

Dynamic Date Parameters using the Tableau JavaScript API - Curtis Harris

https://themarkscard.com/2016/08/03/who-says-tableau-parameters-arent-dynamic/

Hope this helps