Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rohit214
Creator III
Creator III

How to calculate varience%

Hi All ,

i have to calculate the varience with some condotion or logic,

1)if Q8-Q1 varience is -ve then i have to convert into positive value,

2) if Q8-Q1 varience is +ve or zero then convert it zero.

as shown in below.

IDCustomer Name
Dealer Name
Dealer Code
Region
Q1 rating
Q8 Rating



1

C1D1A1XYZ109


2C2D1A1XYZ910


3C3D1A1XYZ810


4C4D1A1XYZ108


5C5D1A1XYZ99


now My requirement is bsaed on below logic

Varience%=total(vaience)/total(Q8 rating) i.e 3/46=6.13%

and required format of able is

IDCustomer Name
Dealer Name
Dealer Code
Region
Q1 rating
Q8 Rating
Q8-Q1
VarienceVarience%

1

C1D1A1XYZ109-116.13%
2C2D1A1XYZ910106.13%
3C3D1A1XYZ810206.13%
4C4D1A1XYZ108-226.13%
5C5D1A1XYZ99006.13%

thanks &regards

rohit

14 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Did you tried with this?

     Alt(if((Q8-Q1)<0,Fabs(Q8-Q1)),0)

Celambarasan

rohit214
Creator III
Creator III
Author

iHi,

Celambarasan

I already tried this and i got the answer but not able to get Varience%

please suggest me how to calculate varience

thanks &regards

rohit

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Here how you arrived 6.13 as Variance %?.

     You mean it would be same for all?

Celambarasan

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,    

     Try something like this

     Sum(TOTAL aggr(Alt(if((Q8-Q1)<0,Fabs(Q8-Q1)),0),ID) )/Sum(TOTAL Q8)

Celambarasan

rohit214
Creator III
Creator III
Author

Hi ,

it comes from varience i.e mean total sum of varience/ total sum of Q8 rating

and that varience%  i want in all rows for all customers

thanks&regards

rohit

rohit214
Creator III
Creator III
Author

Hi

it is not working

thanks &regards

rohit

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Above expression is not worked for you?

     Have you tried with aggr function?

Celambarasan

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Can you post the expression and dimension you used in that chart?

Celambarasan

rohit214
Creator III
Creator III
Author

hi

=sum({<[CS Survey]={'Post Service Follow Up - 2012'},[Question No]={'Q1'},VIN_No_PSFU=p(VIN_No_SBC)>}ans) for Q1

Sum({<[CS Survey]={'SBC'},QuestionNo={'Q8'},VIN_No_SBC=p(VIN_No_PSFU)>}rat) For Q8,

For varience

=If(sum({<[CS Survey]={'SBC'},QuestionNo={'Q8'},VIN_No_SBC=p(VIN_No_PSFU)>} rat)-

sum({<[CS Survey]={'Post Service Follow Up - 2012'},[Question No]={'Q1'},VIN_No_PSFU=p(VIN_No_SBC)>}ans)<0,

Fabs(sum({<[CS Survey]={'SBC'},QuestionNo={'Q8'},VIN_No_SBC=p(VIN_No_PSFU)>} rat)-

sum({<[CS Survey]={'Post Service Follow Up - 2012'},[Question No]={'Q1'},VIN_No_PSFU=p(VIN_No_SBC)>}ans)),0)

Thanks & Regards

Rohit