Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to write Expression for Variance in a Straight Table

I have the below chart image 1, where I need to insert Variances for 2011-2012 & 2011-2013 in a way similar to image 2. any suggestions.variance straight table.PNG

variance.PNG

also how to make the boxes green and red according to +/- growth.

Many Thanks

1 Solution

Accepted Solutions
anbu1984
Master III
Master III

Expressions:

Sum({<Year={2011}>}Sales)

Sum({<Year={2012}>}Sales)

Sum({<Year={2013}>}Sales)

(Column(2) - Column(1))/Column(2)  --Background color expr: If(Column(4) > 0,Green(),Red())

(Column(3) - Column(2))/Column(3)  --Background color expr: If(Column(5) > 0,Green(),Red())

146787.png

View solution in original post

8 Replies
Anonymous
Not applicable
Author

Hello,

you can use this expression:

pow(RangeStdev(Column(1), Column(2)),2)

and so on for others columns.

To colour it, you can use Backgorund colour editing if(Var>=0 green(), red()) where Var is the name of expression.

KR,

Elena

anbu1984
Master III
Master III

Check this app

Anonymous
Not applicable
Author

Thank you Anbu for the APP but my personal edition does not allow me to open any qvw files except created from my PC. Can you post the script or a snap shot

anbu1984
Master III
Master III

Expressions:

Sum({<Year={2011}>}Sales)

Sum({<Year={2012}>}Sales)

Sum({<Year={2013}>}Sales)

(Column(2) - Column(1))/Column(2)  --Background color expr: If(Column(4) > 0,Green(),Red())

(Column(3) - Column(2))/Column(3)  --Background color expr: If(Column(5) > 0,Green(),Red())

146787.png

Anonymous
Not applicable
Author

Elena,

the variance after using your syntax (I copied and pasted in the new expression) is way more. I have attached the result here. May be the expn needs modification..

elena.PNG

Anonymous
Not applicable
Author

Thats perfect, Thank you @anbu. Happy Holidays.

anbu1984
Master III
Master III

Please close the thread, if your queries are answered

Anonymous
Not applicable
Author

Sure Anbu, I will do that. Thanks again.

Regards,