Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

How to create a bar chart with multiple calculated dimensions?

I have a bar chart where I'm using a dimensions like this:

     class(aggr(FirstSortedValue(value, -time), category), 5)

and the measure is

     count(distinct category)

This chart looks like I expect

Screen Shot 2017-09-15 at 3.40.52 PM.png

Now I want to add a second bar to this chart with a dimension like this:

     class(aggr(FirstSortedValue(value2, -time), category), 5)

Charting the second dimension on its own also looks like I expect:

Screen Shot 2017-09-15 at 3.45.08 PM.png

But using both of those dimensions in one chart looks nothing like I expect:

Screen Shot 2017-09-15 at 3.43.09 PM.png

What I would like to see is the two bars from each of the individual charts next to each other.

1 Reply
MVP
MVP

Re: How to create a bar chart with multiple calculated dimensions?

Instead of using two fields value and value2, use a CROSSTABLE LOAD approach to create a single value_combined field and value_type field, creating two records for each input record.

The Crosstable Load

Now use a single calculated dimension using the new  fields

  class(aggr(FirstSortedValue(value_combined, -time), category, value_type), 5)

and two expressions:

=Count({<value_type = {'value'}>}DISTINCT category)

=Count({<value_type = {'value2'}>}DISTINCT category)

Community Browser