8 Replies Latest reply on Nov 22, 2013 9:57 AM by Jonathan Drummey

    How to filter a secondary data source

    Leticia Soroa



      Hopefully someone can help me on this! Going a bit mad!


      Unfortunately I cannot bring all the data in one data source as the refreshing happens at different times so I don't have a choice.. I need to use two different data sources


      What I am trying to do is filtering the secondary data source without removing the data from the first one. - Explaining this -

      When you link two data sources is like doing a left join, you will have all the data from the primary source and then the matching values in the secondary data source and NULL for those that don't exist. When I filter the secondary data source I would expect Tableau to do the same but apparently it does not.

      When I filter the secondary data source (I am basically not selecting anything) ALL the values in the workbook for the Primary source disappear. I was expecting to be able to do this NOT(ISNULL(ATTR([Treemap Trades With Fund].[issuerName]) )) which works if no filters are applied.


      Anyone has any idea if this is possible?


      Not sure if I have explained myself really well...




        • 1. Re: How to filter a secondary data source

          Hi Leticia,


          Would you be able to post a Tableau Packaged Workbook so we can see the issue in more detail? Or if the data is sensitive, to mock up a similar example using Tableau's sample data sets? It would help us understand the problem much faster.




          • 2. Re: How to filter a secondary data source
            Leticia Soroa



            Thanks everyone for replying! I will post a more accurate example as soon I can!!!


            Thanks again,


            • 3. Re: How to filter a secondary data source

              Hi Leticia,


              Right click the secondary data source in the data window, in that select filter. By this way you can add filter for the secondary data source.



              Muthu Krishnan. M

              • 4. Re: How to filter a secondary data source
                Leticia Soroa

                Hello again!


                I have had the time to create a more accurate workbook to show you what I am doing and what the problem is.


                There is much more data than the one I have in this sample but it is a small version. Also less filters etc but the idea I think it is much clearer.


                As you will see in the workbook I have a treemap - Darker red show that there has been a trade in X days before ( controlled by a parameter) and light if there has been no trade.


                The fund filter is used to show the positions hold by that specific fund. Let's say I have fund D selected and Back in Days is 1. RWE is highlighted in red but when I click on it the only trades i see are also done by fund D. What about if I don't really get bother by trades that have been done by other funds or my fund? I want to see the name in the treemap but not in dark - I want to see it in light red.

                This means I would need a second filter with the fund again. In my opinion it should be done in source Treemap Trades With Fund but I never got it to work.


                Let me know if any questions


                Thanks a lot for your help!!


                • 5. Re: How to filter a secondary data source
                  SIdhesh Mangle

                  Hey Leticia, Even i am looking for same solution...


                  I have 2 sources - 1) Primary -> Pulled 31+ Million records from Oracle & created TDE file of it - Works Grt!

                  2) Secondary -> Excel file mapped to 1st table for some product grouping etc..


                  In my Dashboard if i pulled another dimension from secondary & measure from Primary - it shows correct number.

                  But if i try to use that as Filter - It doesn't work, Says the common filed used within 2 sources are not used..


                  I have searched couple of forums, But it seems aggregated new field based on the primary source can't be filtered, Only the joined - common field will be used as filter..


                  Refer these for more info..



                  • 6. Re: How to filter a secondary data source
                    Leticia Soroa

                    Thanks a lot for  your help!


                    I didn't work it out but we changed the way the report works and that was fine with the users.

                    • 7. Re: How to filter a secondary data source
                      Jonathan Drummey

                      Sidhesh, I'm guessing that the aggregate field you are talking about is a regular discrete (blue pill) aggregate, and yes, those are not supported in quick filters (from either primary or secondary sources).


                      In terms of the error you were originally getting, you need to have at least one linking dimension, if Tableau doesn't automatically identify them you can set them up using Data->Edit Relationships, then in the secondary data source for that particular view you can click on the linking icon next to the dimension. I use this kind of blending (doing a grouping via the secondary) pretty regularly and it works well, sometimes it takes a bit more work to set up.



                      • 8. Re: How to filter a secondary data source
                        Jonathan Drummey

                        Hi Leticia,


                        If I'm reading your question and looking at your workbook correctly, it seems like you want the Fund filter to filter both the primary and secondary sources? If so, right now Tableau doesn't do that, filters only work across one data source. The current workaround is to use a parameter-based filter instead.


                        Also, as I looked at the workbook I'm not sure the calculations are set up to give you the results you want. For example, in the IsTradtedXDaysAgoFilter the LOOKUP() does a number of comparisons against the secondary data source. If any of those values are empty, the calcs will return Null and the comparison fail. If you were looking for the LOOKUP() to pad the data, there are other ways to do that, other than that I'm not sure what the LOOKUP() is doing.


                        There are some optimizations in your code that could be done as well, in that same calc the CASE 1=1 is not necessary (you could just use an ELSEIF, for example) and the "IF ISNULL(ATTR([Treemap Trades ].[IssuerName])) THEN TRUE ELSE FALSE END could just be ISNULL(ATTR([Treemap Trades ].[IssuerName])).