2 Replies Latest reply on Mar 2, 2016 8:33 PM by Shinichiro Murakami

    Using a Parameter to activate a set filter

    spenser.troiano

      Hi all,

       

      I've created a calculated field that will allow users to change the dimensions displayed on a bar chart based on a parameter. For example, users can use the parameter to select the amount of unique customers by Region, Ship Mode, City, etc. If a user selects the "City" dimension on the parameter, I'd like the graph to only show the top 5 cities, not the entire dataset. For all other parameter selections, I'd like the graph to show all the data. I tried to solve this by creating set for the city dimension that displayed the top 5 cities based on unique customer count. However, I can't figure out the logic to only activate this filter when the "city" is selected in the parameter.

       

      I tried to use both IF and CASE functions but ran into a ton of errors on each. Essentially I want to create a calculated field with the logic below that I can put on the filter shelf. Any thoughts?

       

      If [parameter] = 'city' then [top 5 city set] else no set

       

        • 1. Re: Using a Parameter to activate a set filter
          Adam Crahen

          Hi Spenser-

           

          Give this a shot.

           

          Create a field called show/hide.  When your parameter is on anything but city then it will say show and then using the rank function we will place only top 5 cities in show.  We are obviously going to Hide the Hide values.

          Show/Hide

           

          IF [Select Level of Detail] = "City"

              THEN IF RANK(COUNTD([Customer])) <=5

                  THEN "Show" ELSE "Hide" END

          ELSE "Show" END

           

          9.2 Attached.

          1 of 1 people found this helpful
          • 2. Re: Using a Parameter to activate a set filter
            Shinichiro Murakami

            Spenser,

             

            Here you go.

             

            [Case] is not flexible enough, but [IF] is.

             

            [Level of Detail Toggle (copy)]

            if [Select Level of Detail] = 'Region' then [Region]

            elseif ([Select Level of Detail] = 'Ship Mode' and [Top 5 City]=true

            or [Select Level of Detail] = 'Ship Mode' and [Top 5 City]=false)

            then [Ship Mode]

            elseif ([Select Level of Detail] = 'Category' and [Top 5 City]=true

            or [Select Level of Detail] = 'Category' and [Top 5 City]=false)

            then [Category]

            elseif [Select Level of Detail] =  'City' and [Top 5 City]=true then [City]

            END

             

            and Put this field in both Rows and filters.  then filter out "Null"

             

             

             

             

            Thanks,

            Shin

             

            9.2 attached.

            2 of 2 people found this helpful