Can you use the #Tableau JavaScript API to filter an SSAS hierarchy?
Yup! But it’ll take some elbow grease.
First, review this article on the finer points of approaching the challenge of filtering an SSAS hierarchy via the URL
http://tableaulove.tumblr.com/post/34653560942/tableau-url-filters-and-the-cube
The code below will filter the promotions hierarchy mentioned in the previous article. In fact, it’ll filter to the same attribute member in the same attribute hierarchy. “Magic stuff” is in bold:
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);
}
}
Attempts to do this work with chained applyFilterAsync() calls are failing for me. It appears you must apply the filter to all levels of the hierarchy at the same moment.