Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Selected field when using Aggr and Set Analysis in a calculated dimension

Hi,

Presumably I am doing something wrong but I do not understand QV's behaviour in the attached document.

This is the data I am working with in the example:

Quarter, 2QRolling, Sales, QuarterIndex

  2014 Q4, 14Q3-14Q4, 100, 12

  2014 Q3, 14Q3-14Q4, 100, 11

  2014 Q2, 14Q1-14Q2, 100, 10

  2014 Q1, 14Q1-14Q2, 100, 9

  2013 Q4, 13Q3-13Q4, 150, 8

  2013 Q3, 13Q3-13Q4, 200, 7

  2013 Q2, 13Q1-13Q2, 210, 6

  2013 Q1, 13Q1-13Q2, 300, 5

  2012 Q4, 12Q3-12Q4, 150, 4

  2012 Q3, 12Q3-12Q4, 150, 3

  2012 Q2, 12Q1-12Q2, 150, 2

  2012 Q1, 12Q1-12Q2, 150, 1

This is what I am trying to achieve:
a) data are aggregated by the field [2QRolling] (see chart: Bar - 2QRolling)
b) when I make a selection in the chart by selecting a bar, the selection occurs on the field [Quarter] (and not in [2QRolling])

c) all the values for [2QRolling] have to be displayed in the chart

To meet the requirements above I use the following calculated dimension:

= Aggr(Only({<[Quarter]=P({1}[Quarter])>} [2QRolling]), [Quarter])

Aggregation around [Quarter] should guarantee that the selection happens on [Quarter] (correct?).

Only({<[Quarter]=P({1}[Quarter])>} should instead guarantee that I consider all the quarters - hence all the [2QRolling] - no matter what quarter is selected. Right?

Given how the dimension is defined I then simply use the following expression: = Sum({1}[Sales])

The problem I am having, and I cannot explain, is that when I select a bar the first time I get the right selections on the quarter (e.g. 13Q3-13Q4 returns Quarter: 2013 Q4, 2013 Q3). When I select a second time any other bar the selections get cleared out and no quarters are selected. If I re-select the same bar a second time the corresponding quarters get correctly selected.

You can try to play with the attached document and see the behaviour described.

Any feedback would be appreciated.
Thanks

0 Replies