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

    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
  • Jacob Folsom
    **Say “Thanks” by clicking the “heart” in the post that helped you.
    **Please mark the post that solves your problem by clicking on "Accept as Solution"
This discussion has been closed.