I had a requirement to filter a chart on the highest and lowest value shown in a table.
The table was sorted by measure value Z-A, so the first and last row will always be the highest and lowest.

var result = Table_2.getDataSource().getResultSet(); // get the result set of the table
var Dimension = Table_2.getDimensionsOnRows()[0]; // get the Dimension in the first row
var Members=[''];
for(var i=0; i<result.length; i++)
{ var cell = result[i];
if( i===0 || i===result.length-1) {Members.push(cell[Dimension].id);} }
/* The loop runs for the length of the result set, ergo i=0 will be row 1, result.length-1 will be the last row
we need the minus 1, as the result set is 11 long but it starts at 0, so value 11 will be returned as 10 */
Chart_2.getDataSource().setDimensionFilter(Dimension,Members); // apply the filter
Code language: JavaScript (javascript)
