Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Not applicable

Histogram in Qlik Sense

Hi,

I am now investigating the feature set in Qlik Sense by creating different sheets in the Desktop app. Everything works wonderfully, but there is one very important thing that I cannot find - how do I create frequency histogram charts? I am looking for something very basic. I have 100 shops and for each shop I have the product count. I want to create a simple histrogram bar chart and assign product count intervals to the bars. For example, bar1 (product count = 0), bar2 (product count = 1-10), bar3 (product count = 11-20), etc. Help is appreciated!

I am really looking forward to hearing from you!

Thanks,

John

5 Replies
lironbaram
Honored Contributor II

Re: Histogram in Qlik Sense

hi

you can use the class function

your dimension will be an expression

class(aggr(count(productid),Storeid),'X',10)

this will create a histogram with range of 10

your measure will be

count(distinct Storeid)

Not applicable

Re: Histogram in Qlik Sense

Thanks. Is it possible to define custom bins instead of the constantinterval? For instance, I would like to have the following bins:

bin1 = 0

bin2 = 1-10

bin3 = 11-20

bin4 = 21-50

bin5 = 51-100

bin6 = 101-1000

bin7 = 1001-infinity

lironbaram
Honored Contributor II

Re: Histogram in Qlik Sense

Hi

With class this not possible easily

But if you use if statment in your dimension

You can do what you are looking for lees elegant but working

You can add a fourth paramter to class that sets offset

So start from there and move on

Not applicable

Re: Histogram in Qlik Sense

Is there really not an easy and elegant way to do basic histogram with custom bins? I remember this functionality being present in excel 20 years ago.. I would really appreciate help - I want Qlik Sense to work for our company, but if Histograms are not available I will not be able to "sell" this to my management.

Re: Histogram in Qlik Sense

A fairly simple and flexible way to utilize bis of differing widths is to assign the Bin in script using IntervalMatch. Here's an example.

data:

LOAD

  round(rand() * 2000) as Value

AutoGenerate 500;

Bins:

LOAD * INLINE [

Bin, Start, Stop

bin1, 0, 1

bin2, 1,10

bin3, 11,20

bin4, 21,50

bin5, 51,100

bin6, 101,1000

bin7, 1001, 9999999999

];

IntervalMatch(Value)

LEFT Join(Bins)

LOAD Start, Stop resident Bins;

DROP FIELDS Start, Stop;

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

Community Browser