2 Replies Latest reply on Nov 5, 2013 9:50 AM by Ramon Martinez

    Filter across various flags set in a table

    Zack Chow

      Hi everyone,


      I got a huge table whereby i had set various flags denoting certain attributes of the record. 1 would indicate yes and 0 would indicate no. Something like this below:


      Primary KeyFlag 1Flag 2Flag 3


      I would like to build a flag filter (aka a drop down menu to select flag 1, flag 2 or flag 3), such that when i select the flag, only those records marked as 1 would be included, and those marked as 0 would be excluded for the flag selected.


      So if I select flag 1, only record 1,3 and 4 should show. For flag 2 only record 2 and 5 and flag 3, record 2, 3, 4, 5.


      Is this possible in Tableau???

        • 1. Re: Filter across various flags set in a table
          Aaron Clancy

          It  appears that Zack only wants want one selector but I could be wrong.

          Create a parameter called parameterflag with the number of possible flags as your values.







          Build a Calc with that says:

          if [parameterflag] = 'flag1' then if [flag1] = 1 then 'yes' else 'no' end

               elseif [parameterflag] = 'flag2' then if [flag2] = 1 then 'yes' else 'no' end

              elseif [parameterflag] = 'flag3' then if [flag3] = 1 then 'yes' else 'no' end


          (There is a more elegant wat to do this but I kept it less elegant so that the logic would be easily understood)


          Place the calc on thefilter shelf and select 'yes'  

          (Make sure your parameter is set to a value that is possible to hit.)

          I didn't test the calc so if there's any syntax errors you'll have to fix them.

          1 of 1 people found this helpful
          • 2. Re: Filter across various flags set in a table
            Ramon Martinez

            Hi Zack,


            The implementation depends on how your data is structured. The sample data included in your original post is a crosstab and usually the data is normalized. See both approaches in the two data sources the attached workbook is connected to.


            The attached workbook includes the implementation of the solution to your problem on two variants, considering the data is normalized and having the data as you presented in your post.


            Aaron made the right recommendation to filter your data based on your requirement.


            You can see it implemented in the workbook.