4 Replies Latest reply: May 6, 2009 2:25 AM by John Witherspoon

# How to display multiple boolean dimensions along the X-axis?

Hi folks. I have a somewhat strange graph I'm trying to build and I can't figure it out.

So I have 5 boolean (Yes/No) fields in my table, let's call them Flag1-5. I have another dimension called Category.

I want to create a stacked bar graph that shows how many records exist that have each flag set segmented by Category.

So I want to see the 5 flag fields along the X axis, so 5 bars, and each bar segmented by Category, with the count as the expression.

Since you can only have 2 dimensions in a stacked bar graph, I'm not sure how to do this. Can anyone give me some advice and examples? Thank you!

• ###### How to display multiple boolean dimensions along the X-axis?

I believe you have to make a "fake" dimension. The attached example gives two different approaches for this. The first handles it all within the chart by using a synthetic dimension that is a ValueList from 1 to 5, then referencing that list to decide which flag to use. The second handles it largely within the script by adding a Flags table with Category, FlagName and FlagValue. The expressions also take advantage of the fact that Boolean values are internally -1 for true and 0 for false by doing a -sum(Boolean expression) to get a count of trues, though I went ahead and used a Y/N for your own flags to show that it can still be done with whatever definition you want for your flags.

• ###### How to display multiple boolean dimensions along the X-axis?

Wow! This is slick! I thikn we're almost there. One thing though, your graph for the Chart solution has integer values 1,2,3,4,5 on the X-axis. Is there a way I can have text values instead? Like 'A','B','C','D','E' ?

• ###### How to display multiple boolean dimensions along the X-axis?

Certainly. The only extra bit is that the pick() function I used needs an integer, so we need to convert the text values from the dimension into integers. That's easily done with a match() function. Adjusted example above using the same names as the other graph. It could probably be just as easily done with a dual() function in the dimension, but I very routinely use pick(match(...),...), so I'll stick with that.

• ###### How to display multiple boolean dimensions along the X-axis?

There is "Stacked" property on the Style tab for bar charts that will let you do this.