Skip to content

Instantly share code, notes, and snippets.



Created Aug 20, 2019
What would you like to do?
Tableau getFilterValues
function initializeViz() {
const url = "";
const div = document.getElementById("container");
let options = {
// when the viz has finished loading get the workbook
onFirstInteractive: () => {
let workbook = viz
.get("Storm Map Sheet")
viz = new tableau.Viz(div, url, options);
document.addEventListener("DOMContentLoaded", initializeViz);
document.getElementById("btn").addEventListener("click", getFilteredValue);
function getFilteredValue() {
.get("Storm Map Sheet")
.then(filters => {
const value = filters[0].getAppliedValues()[0].value;
const field = filters[0].getFieldName();
console.log(`Filtered ${field} for ${value}`);
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Get Filter Values Example</title>
<script src=""></script>
<h1>Get Filter Values Tableau Dashboard</h1>
<p>Open the console and click the button below</p>
<button id="btn">Click here</button>
<div id="container"></div>
<script src="app.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.