top of page

Add BreakBy filter to dashboard when click on stacked chart

If a user click on a stacked chart, Sisense will add dashboard filter for the dimension in 'Categories' panel, but not for dimension in 'Breakby' panel. By adding below script to widget, filter for breakby dimension also get added to dashboard.

widget.on('processresult', function(se, ev){
	$.each(ev.result.series, function(index, value){ = {click: function(event){
						var filterOptions = {
							save: true,
							refresh: true,

						breakbyFilter = {
							jaql: {
								collapsed: true,
								column: ev.widget.metadata.panels[2].items[0].jaql.column,
								datatype: ev.widget.metadata.panels[2].items[0].jaql.datatype,
								dim: ev.widget.metadata.panels[2].items[0].jaql.dim,
								filter: {members: []},
								merged: true,
								table: ev.widget.metadata.panels[2].items[0].jaql.table,
								title: ev.widget.metadata.panels[2].items[0].jaql.title


						var isSameMemberFilterExist = _.some(prism.activeDashboard.filters.$$items,
															 function (filter) {

							var isDatasourceSame = _.isMatch(filter.jaql.datasource, breakbyFilter.jaql.datasource);

							return (filter.jaql.dim == breakbyFilter.jaql.dim &&
									filter.jaql.filter.members &&
									filter.jaql.filter.members.toString() == breakbyFilter.jaql.filter.members.toString() &&

						if (isSameMemberFilterExist) {
							delete breakbyFilter.jaql.filter.members;
							breakbyFilter.jaql.filter.all = true;
							prism.activeDashboard.filters.update([breakbyFilter], filterOptions);
							prism.activeDashboard.filters.update(breakbyFilter, filterOptions);

Note: 'Clear Selection' button in widget title bar will not clear break-by filter

287 views0 comments

Recent Posts

See All


bottom of page