Parameter based dynamic fields & Custom parameter value

Hi Domo,

 

Is there any way to change field dynamically based upon parameter value?

For example: I want to build single Pie chart for different fields like Country, State, City & Region.

  1. How can i create parameter with just text values Country, State, City & Region.

and

  1. How can I change my fields in pie chart based on above parameter value.

 

If user selects Country from parameter then the chart should automatically show categorization based on country & vice-versa 

 

Thanks in advance

 

Reference : https://www.edureka.co/community/42920/changing-filter-values-based-parameter-selection-tableau

 

cc @ST_-Superman-_ 

Comments

  • The only way that I can think to accomplish this would be through some sneaky data engineering.  You would need to be careful about how the dataset was going to be used because anyone not familiar with the structure would likely double or triple count you value.

     

    That being said, what I think you want to do is to "stack" your data.  You should be able to use something like this:

    SELECT
    'Country' as `Parameter`
    ,`Country` as `Parameter Value`
    ,`VALUE FIELD FOR PIE CHART`
    FROM `your_table`

    UNION

    SELECT
    'State' as `Parameter`
    ,`State` as `Parameter Value`
    ,`VALUE FIELD FOR PIE CHART`
    FROM `your_table`

    UNION

    SELECT
    'City' as `Parameter`
    ,`City` as `Parameter Value`
    ,`VALUE FIELD FOR PIE CHART`
    FROM `your_table`

    UNION

    SELECT
    'Region' as `Parameter`
    ,`Region` as `Parameter Value`
    ,`VALUE FIELD FOR PIE CHART`
    FROM `your_table`

    This will essentially give you four copies of your data set all stacked on top of eachother.  You would create a filter card with the `Parameter` field.  Then your Pie chart would use `Parameter Value` for the Pie name and whatever your value field is for the pie value.

     

    I would recommend adding a summary number like this to the pie chart so the user would know that they need to select a single parameter first

    CASE 
    WHEN COUNT(DISTINCT `Parameter`) >1 then 'Please Select a Single Parameter from the Filters'
    else concat(`Parameter`,' view')
    END
This discussion has been closed.