Skip to main content
Announcements
Qlik Community Office Hours - Bring your Ideation questions- May 15th, 11 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variance on 2 calculated values

Just looking for a way to calculate the Variance of a pair of Calculated values.

It's for a straight table chart with a date dimension and a few aggregate expressions. They want the variance of a pair of the expression results, per day.

Checked the ref-man and there's no convenient Variance function.

1 Reply
johnw
Champion III
Champion III

I gather you want variance in the sense of the mean squared difference between the two expressions? In that case, avg() is the mean function, and sqr() is the square function, so you should be able to do this to get the variance between two expressions:

avg(sqr(Expression1 - Expression2))

But are you sure you want variance? Since variance is squared, the unit of measure is the square of the unit of measure of the original expressions. I would expect people to find it much easier to interpret the square root of the variance, which would be the equivalent of a standard deviation, but between two numbers, I guess. That gives you a number in the original unit of measure:

sqrt(avg(sqr(Expression1 - Expression2)))

That isn't technically what you asked for, though.