1 Reply Latest reply on Nov 6, 2016 5:35 PM by Michael Hesser

    Using IF as a condition for parameters

    Shivang Desai

      Hi Guys,

       

      I am stuck with using IF condition for parameters in Tableau. I am trying to use IF condition for parameters such that for every parameter I select in order,  the data should be displayed.

       

      My parameters: Select Division, Select Product Class

       

      (MAX(IF [Division] = [Select Division] AND (ISNULL([Select Product Class]) OR ([Product Class] = [Select Product Class])) and [FullDate] >= [Start Date] and [FullDate]<= [End Date]  THEN 1 else 0 END)  +

      MAX(IF [Division] != [Select Division] AND (ISNULL([Select Product Class]) OR ([Product Class] != [Select Product Class])) and [FullDate] >= [Start Date] and [FullDate]<= [End Date]  THEN 1 else 0 END)) = 2

       

      What I am trying to do with this condition is on selecting 1st parameter and keeping second parameter blank, only the data related to first parameter should be displayed. Then when I select the second parameter, the data should be displayed based on parameter 1 and parameter 2.

       

      If I select parameter 2 and parameter 1 is blank then I should not get any results because parameter 2 is dependent on parameter 1.

       

      [I am not sure how to keep parameter value blank or nothing]

       

      If you guys have any query, please do let me know.

       

      Kind Regards

        • 1. Re: Using IF as a condition for parameters
          Michael Hesser

          Hi Shivang;

          I'll watch closely so I can see if I'm proven wrong-- but I don't think parameters are the way you want to go.

          This is because while parameters can be loaded from a dimension, they don't "refresh", so delimiting your set of valid values won't carry over into the parameter.

          I think you're going to want to use calculations (or a combination of the two), which you can then use as filters.

          When you display your filters, choose Show Relevant Values Only. This last part will limit your selections to just the valid values (based on the filters preceding it).

          So if you have a filter of [State] and then [City] and choose Texas, you list of cities would be reduced to {Austin, Dallas, Houston, etc}

           

          Too simple? Let me know! --Michael