Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Standard Deviation and Median in Bar Chart

Hey guys,

I'm currently building an application and I'm in need of a chart giving me an overview of the median and the standard deviation.

I have a field named duration. So basically I need the Standard deviation and median of this field as the dimension of my barchart. And as the expression I need a count of my OrderID's.

However if I build my chart in qlikview, it says error in calculated dimension.

How can this be solved.

ALL help is welcome 🙂


Dimension = STDEV(Duration)
Expression = Count(OrderID)

5 Replies
spsrk_84
Creator III
Creator III

create a calculated Dimension at chart level or create the same dimension in the EditScript Part if Possible.

Rgds,

Ajay

Not applicable
Author

Dear Ajay,

Thanks for you help, I'm working with a calculated dimension at chart level.

Hardcode my Median and Standard Deviation at script level is not intresting for my solution. Because the purpose of my chart is for it to be dynamic.

Still help is welcome 🙂

Regards

Sajjad,

Not applicable
Author

BUMP!

Not applicable
Author

This is what I'm looking to achieve in my chart.

I Need 1 dimension going from (M - 3SD to M +3SD)

M = Median
SD = Standard Deviation

I Need 1 expression counting the OrderID's

The class function doesn't seem to help much.

Enclosed you will find an image of the chart I made in paint

ALL help is still welcome 🙂

johnw
Champion III
Champion III

Well, I thought this would work (though not generate the legends you want):

Dimension = class(Duration,stdev(Duration),'Duration',avg(Duration))

But it doesn't. If I replace the two functions with the values they return, it DOES work. Oh, that's right. I can't do aggregation functions in a dimension without using aggr(). Well, actually, in this case, we can do it with a dollar sign expansion. So this:

Dimension = class(Duration,$(=stdev(Duration)),'Duration',$(=avg(Duration)))

And that gives us the right intervals for our dimension, but labels them in an ugly way. So we probably just have to beat it with a hammer instead of being clever:

Dimension =if(Duration<$(=avg(Duration))-3*$(=stdev(Duration)),dual('EXTR',1)
,if(Duration<$(=avg(Duration))-2*$(=stdev(Duration)),dual('M-3SD',2)
,if(Duration<$(=avg(Duration))-1*$(=stdev(Duration)),dual('M-2SD',3)
,if(Duration<$(=avg(Duration))-0*$(=stdev(Duration)),dual('M-1SD',4)
,if(Duration<$(=avg(Duration))+1*$(=stdev(Duration)),dual('M+1SD',5)
,if(Duration<$(=avg(Duration))+2*$(=stdev(Duration)),dual('M+2SD',6)
,if(Duration<$(=avg(Duration))+3*$(=stdev(Duration)),dual('M+3SD',7)
,dual('EXTR',8))))))))

See attached.