Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Quartiles as Added Dimension

Hi All,

This is my first question and I am fairly new to QV. The challenge is to have individual bars set for (Q1, Median and Q3) beside the usual items in your dimension. So, for example, the bar chart would display, say for example sales by region ---

Q1     Q2     Q3     Region1     Region2     Region3 etc

Where Q1, Q2 and Q3 would be along the lines of Fractile(Aggr(Sum(Sales), Region), .25) and the Region values would simply be Sum(Sales). I am having trouble adding this new bars (quartiles) in the chart dimensions or is that even possible?

Please feel free to propose alternatives. I've tried

1. Reference Lines

2. Coloring the individual Region bars depending on quartile position.

But I really do need them set up like above as a requirement. I am hoping there is a way to do this using calculated dimensions.

Thanks in advance!

Francis

1 Solution

Accepted Solutions
marcus_sommer

That's possible if you add the Q's within the script to this dimension - I have now added such example.

- Marcus

View solution in original post

6 Replies
marcus_sommer

Please provide a small example with a few inline-data.

- Marcus

Not applicable
Author

Hi Marcus -

Thanks for taking interest. I've attached a small sample with just 1 sales record per region. I've modified the chart inside to reflect what I hope to achieve.

marcus_sommer

In this way it's not possible because you have a middle scale and left and right bars. For this you will need two barcharts which are overlapping eachother and adjusted layoutings. Is this not important you could put it into one barchart by using a calculated dimension or extending your Region field (or a copy from them) to the Quartile and query then within the expression which value these dimension then have.

Within the attachment you will find two possible solutions.

- Marcus

Not applicable
Author

Thank you so much! The 2nd option is what I am looking for.

Is there anyway to make a more general expression for both the dimension and values? Say, something like

Dimension: valuelist('Q1', 'Q2', 'Q3', $(=concat(distinct Region, ', ', Region)))

Expression: if(Q1, Fractile(Exp,.25), if(Q2, Fractile(Exp, .5), if(Q3, Fractile(Exp, .75), else do the generic expression for each region.

I see that the solution you provided requires you to list all region items which could be not practical in real world applications.

marcus_sommer

That's possible if you add the Q's within the script to this dimension - I have now added such example.

- Marcus

Not applicable
Author

I see. This is very helpful. Thank you so much!