3 Replies Latest reply: Jan 18, 2017 8:04 AM by Jonathan Dienst

# Expressions in dimensions

Hello

Hope I can explain this properly.

We have a bunch of bunch of expressions that we would like to use as dimensions and bunch of dimensions as expressions. The expressions are derived from our dataset and we would like to slide the dimensions based on the expression values if that makes sense.

For e.g.

We have CustomerA, CustomerB and CustomerC as fields in our table and orders as expressions. If we want to show expressions as dimensions on x axis i.e. say Orders 10-100, 100-1000 and so on and then show customer A, B and C in a bar graph stacked on y axis?

Has anyone loosely implemented this or point me to an article that does similar kind of things?

Thanks

• ###### Re: Expressions in dimensions

I think you need two dimensions... 1st will be a Calculated Dimensions and second dimension will be Customer. Then use your expression for what those bar seems to be plotting

• ###### Re: Expressions in dimensions

It is certainly possible, but the coding/expressions will be quite specific to your data model. If you upload a smalls ample qvw with representative data, you may get more specific and accurate help.

In general, though, your first (calculated) dimension would look something like:

If(Count(Orders) > 1000, Dual('1000+', 1000),

If(Count(Orders) > 100, Dual('100 - 1000+', 100),

If(Count(Orders) > 10, Dual('10 - 100+', 10),

Dual('<10', 0))))

Customer would be the second dimension,

Sum(Sales) or whatever you need as a metric.

Duals allow for correct sorting of the groups in the calculate dimension. Sort numerically.