Script to hide only one column in table with column dimensions

I have a table visualization with several measures, a row dimension and a column dimension. I want to hide a particular measure for only certain values of the column dimension.

I can’t use something like:
tblExample.control.columns[1].isVisible = false;

because that hides the measure for all column dimension options.

I have also tried many combinations of scripts similiar to
tblExample.metricSetBindings[0].dataResult.cellset.columns[1].visible = false;

but nothing seems to work. Is it possible to do something like this? I don’t need to key off the column dimension value, per se, I am fine just saying hide columns 2, 4 and 8, for example, like you could do in a .Net datagrid, for example.


Not sure on your exact requirements.
Does this have to be dynamic? If not you could try the built in properties, or have you tried css?

It does not have to be dynamic, I know ahead of time what I want to hide. What built in properties are you referring to? I can’t select the measure and hide it because I want it to show for some of the column dimension values but not other. I also am not sure how to apply css to just one table. Can you give me more detail on either of those options you referred to? Thanks!

To clarify, in example below, I only want # measure to show for Tim, not the $ measure.

Region Bob Carol Tim
# $ # $ #

Sorry, the format of that table did not come through well. Basically showing two measures for each person per Region. For Tim, don’t want to show $ column, only the # column.

Hi @kelly.lowary,

How are you generating these measures? I would guess that your metric set looks like this from what you are describing.


But in this case, you can certainly use the .column[x].isVisible… so I must be missing something.

@jeff, yes, that is basically it. But when I use tblExample.control.columns[1].isVisible = false;
it hides the measure every time. I want to choose the exact column instance to hide.

Here are shots of the actual data to clarify what is happening.
This is the untouched data:

Here is the data after the line of script. Note that it hides every “# of Lines” column, not just the one under “2 Days” and “> 14 Days”.


I want to choose to hide it under “2 Days” and “> 14 Days”, for example.

This use case is more complicated but one other use case I have had is when I use the PERCENTTOTAL calculated measure with a row and a column dimension. Often I want to hide this measure only under the Grand Total column for space reasons because it is always 100% (when looking at the % going across the rows).

Hi Kelly,

Thanks for the clarification. Unfortunately, the metric set does not support surgically removing columns like you are asking.

If you can restructure your data to provide every column as a measure, you will certainly be able to solve this. Maybe you can create a new view or data cube to help as an intermediary? Specifically, the Pivot Transforms in the data cube might be helpful if you data isn’t changing very often.

Ok, thanks for confirming that it isn’t possible and thanks for the suggestion.

This would be a really useful feature. Being able to surgically hide would cut down the number of formula visualizations I have to use and constantly re-create :grinning: