Discussion Board for collaboration related to QlikView App Development.
I hope you all are doing well. I want to ask one question.
I have two fields in my table having String and Numeric Values
Fields a having 1000 Records & fields B having 700 I want to divide these two Fields and Want to create New Fields as Percentage in Script Itself not in chart.
Data is as below
Total (B)/Total (A) =%
Any Suggestion Please Help
Load FieldA From XYZ;
Let vTableA = NoOfRows('A');
Load FieldB From XYZ;
Let vTableB = NoOfRows('B');
Load $(vTableA)/$(vTableB) as Percentage
Drop table A,B;
Do you mean to count them? in script?
LOAD Count(A) As CountA / Count(B) As Percentage
Let vPercentage = Num(Peek('Percentage'), '0.0%');
Use Field Percentage or variable vPencentage.
one solution to add a new field in the same table could be:
//test data generation
LOAD If(Rand()>0.1,Left(KeepChar(Hash256(RecNo()),'01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'),11)) as A,
If(Rand()>0.3,Left(KeepChar(Hash256(RecNo()),'01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'),11)) as B
Left Join (table1)
LOAD Num(Count(B)/Count(A),'0%') as Percentage
hope this helps