1 Reply Latest reply on Oct 27, 2013 5:19 PM by Russell Christopher

    API to apply filter on an SSAS hierarchy

    Shalin Kapadia

      Hi,

       

      We have a dashboard with a few worksheets on it. The data source for our reports is an SSAS database. We are trying to filter the data by passing the members to the dashboard using the applyFilterAsync() JavaScript API, however, we are unable to get it to work. We have tried a few options like [dimension].[hierarchy].[level].&[id], [dimension].[hierarchy].[level].[caption], just the &[id], etc but nothing seems to be having any effect on the dashboard.

       

      Please could you let us know the correct way of filtering on an SSAS hierarchy using Tableau JavaScript APIs?

       

       

      Thanks and Regards,

      Shalin

        • 1. Re: API to apply filter on an SSAS hierarchy
          Russell Christopher

          Filtering cubes is tricky. Use this for reference:

           

          Tableau, URL Filters, and the Cube | Tableau Love

           

          In order to filter correclty, you must specify a value for ALL levels of the hierarchy.

           

          Attempting to filter on the Type level of the hierarchy below requires you choose a value for the Category level, too:

           

          tumblr_mcq3psyemM1ql3h8n.gif.

          tumblr_mcq3or5QmN1ql3h8n.gif

          ...To choose "Discontinued Product", I have to do something like this:

           

          function doSomething () {

           

            var placeholderDiv = document.getElementById("content");

            var url = "http://localhost:8000/views/Book1/FilterMe";

            var options = {

                 hideTabs: true,

                 hideToolbar: true,

                 "[Promotion].[Promotions].[Category]": "[Promotion].[Promotions].[Category].&[Reseller]",

                 "[Promotion].[Promotions].[Type]": "[Promotion].[Promotions].[Type].&[Discontinued Product]"

            };

            try{

                 var viz = new tableauSoftware.Viz(placeholderDiv, url, options);

            }

                 catch (e){

                 alert(e);

            }

           

          You might be able to get this working by firing applyFilterAsync() twice (once for each value pair), but I suspect it won't work.