1 2 Previous Next 24 Replies Latest reply on Jul 26, 2016 1:46 PM by Adam Borenstein

    Adding Specificity to Filters

    Adam Borenstein

      I have a network graph with just over a thousand nodes, each identified by an ID number. Each connection in the graph is identified by a string called  "Relationship", which is written in the form of "node ID 1 <-> node ID 2". The graph is then drawn using the relationships to connect each node, based on its ID.

       

      I have set Relationship as a filter, and can filter for 1st degree connections by searching for the node number in that field. However, when filtering for all the connections node 255 is involved in, I also get results for node 1255. I have looked into using a "Starts with" function, though I need to be able to search for all connections a node is a part of, not just those it occupies the "source" side of the relationship. In essence, I need to search relationships for node 255, as both the source and the target, without returning results that also have the number 255 in them (in this case, only 255 and 1255 will return, but it becomes a more evident issue when searching for node 1, 10, etc).

       

      What might I be able to put into the formula section of the Relationship filter to establish specificity?

        • 1. Re: Adding Specificity to Filters
          Cathy Bridges

          I would try creating a parameter for all your nodes this is what will feed your filter.

           

          Then in your filter, I would add the "node ID " part... so basically searching for "node ID 255" is going to eliminate "node ID 1255".

           

          Create your filter as a calculated field like this:

          CONTAINS([Relationship],[Node Parameter])

           

          Then drop it on the filter shelf and set the filter to "True". You would then select the node you want via the Parameter.

           

          I whipped up a similar filter using names in the attached. See if this would work for you.

          • 2. Re: Adding Specificity to Filters
            Adam Borenstein

            Hi Cathy,

             

            Thanks for your response. I have tested your suggestion and it still brings about the same problem.

             

            Using your workbook as an example, when you filter for the name "Alan", the name "James Galang" is still returned, as "Alan" is contained in "Galang". Might you have a suggestion as how to filter for "Alan" or "Allen" as a first or last name only, but not as part of the first or last name? E.g. I would want "Allen Goldenen" and  "Andrew Allen" to have their names returned, but not "Alejandro Ballentine"?

            • 3. Re: Adding Specificity to Filters
              Cathy Bridges

              I'm thinking in your case you would want to include the text "Node ID ", which I failed to add to my sample calculated field.

               

              It should be:

               

              CONTAINS([Relationship],"Node ID "+[Node Parameter])

               

              which translates to

               

              CONTAINS([node ID 123 <-> node ID 255],"node ID "&[255])

               

              This should catch your references to 255 without catching 1255, because what you're actually saying is your filter has to include the number you want, but only if it follows the "node ID " as a prefix.

               

              Attached is an example using data similar to what you're describing.

              • 4. Re: Adding Specificity to Filters
                Cathy Bridges

                sorry it's + not & in the calculated field

                • 5. Re: Adding Specificity to Filters
                  Gerardo Varela

                  Hi Adam,

                   

                  Using Cathy's suggestion I think I came up with something (I have been wrong before!).  From the superstore data I've split customer name as Source (First Name) and Target (Last Name).  I've added both as a list to the parameter, Customer Name Parameter.

                   

                  I then made a calculated field

                  [Filter]

                  IF [Customer Name Parameter]= [Source] OR [Customer Name Parameter]= [Target] THEN "True" END

                   

                   

                   

                  Attached workbook is version 9.3. If you have any questions, please post back!

                   

                  Regards,

                  Gerardo

                  • 6. Re: Adding Specificity to Filters
                    Adam Borenstein

                    Hi Cathy and Gerardo,

                     

                    Cathy- Though adding "node ID" to the parameter is a step in the right direction, it is not a great fix. For example, Node 255 is still shown when searching for Node 2, as Node 255 begins with/Contains "Node 2...". If there was a "contains exactly" or "contains match" type of function that might do the trick...

                     

                    Gerardo- I'm sure this is a function of how my data is structured, but using your solution filters for the nodes themselves. For example if I set the filter to Node 1, the resulting visualization shows only Node 1, not Node 1 and all the nodes it is connected to. I would need a filter to examine and work with portions of the string that is "Relationships".

                     

                    Thanks to both of you for your continued help. My feeling is that a solution will lie in writing something into the condition section (By formula, see highlighted picture) of the relationship filter. Unfortunately I am not well versed enough with Tableau to know what to put there to get the results I need.

                    Capture.PNG

                    • 7. Re: Adding Specificity to Filters
                      Cathy Bridges

                      Great point - sorry I didn't catch that. Hmm...this is a great puzzle. I feel like there's a really simple solution I'm not seeing yet.

                      • 8. Re: Adding Specificity to Filters
                        Cathy Bridges

                        OK, I thought of one more possible "cheater" way to make this work. I'll play around with the sample workbook and try it out.

                         

                        I'm thinking that if the relationship field was duplicated and then appended with this part: <-> you could search for everything from node ID to the <, which should be inclusive of the entire node.

                         

                        Gimme a minute to try it out...

                         

                        OK try out the attached. Requires a little fudging, but I think it works. You don't have to use the new relationships field in your viz, it's just for calculating the filter.

                        • 9. Re: Adding Specificity to Filters
                          Gerardo Varela

                          Is it possible for you to post a tad bit of how your data is structured? In this exercise I've answered one of your questions (albeit wrongly for the time being which i knew I might be wrong).  How about 3 primary nodes and the corresponding secondary nodes.   After that, would you tell us what the end result should be, after filtering?  We do not need real data just something to play with.  If I can't get this solved I know Cathy is highly capable (big fan). If not someone else brighter than me might mind an easy solution. 

                           

                          Regards,

                          Gerardo

                          • 10. Re: Adding Specificity to Filters
                            Adam Borenstein

                            Sure. Give me a few minutes to whip together a smaller set.

                            • 11. Re: Adding Specificity to Filters
                              Adam Borenstein

                              OK here it is. Because of the way I've truncated the data there are some weird things going on when using the filter I've put in (like data points showing up that aren't connected to anything when filtering), but this isn't a problem I have with the full set so I'm not worried about it.

                               

                              As you can see, when the relationship filter is set to "255", both node 255 and 1255 (with their respective connections) show up.

                              • 12. Re: Adding Specificity to Filters
                                Gerardo Varela

                                Thanks Adam! Take a look at the attached. I've applied the same logic from above to your data set. First, I split your relationship dimension in to it's left and right sides.  Then added both to Parameter list.

                                 

                                Regards,

                                Gerardo

                                1 of 1 people found this helpful
                                • 13. Re: Adding Specificity to Filters
                                  Adam Borenstein

                                  Thanks Gerardo! This is what I needed!

                                   

                                  I was wondering if I could ask for one more bit of functionality. Is there a way to quickly turn the Filter on and off, such that without any number chosen in parameter (possibly a NULL or 0 value could be chosen), the map shows the entire image, but then when a number is chosen, the graph filters down to what is chosen in the parameter?

                                  • 14. Re: Adding Specificity to Filters
                                    Gerardo Varela

                                    Here you go.  In the attached I added -2 and a -1 and changed the aliases to All and Null respectively.  I've changed my Calculated field Filter to the following.

                                     

                                    IF

                                        [Parameter]= [Relationships - Split 1] OR

                                        [Parameter]= [Relationships - Split 2] OR

                                        [Parameter]= -2

                                        THEN "True"

                                    END

                                     

                                    When "All", -2, is chosen then the logic above evaluates as true and all values are displayed.  The reverse can be said about ""Null", -1.

                                     

                                     

                                     

                                    I'm making the assumption that you do not have any negative node ID's but if you do just change the value to something a little more obscure.

                                     

                                    Regards,

                                    Gerardo

                                     

                                    Ninja edit: I had -1 and -2 mixed.

                                    1 of 1 people found this helpful
                                    1 2 Previous Next