Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
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
A B
35087982308 35087982308
44058947209 44058947209
1B007394207 1B007394207
1H001557008 1H001557008
1M006698108 1M006698108
Total=1000 Total=700
Total (B)/Total (A) =%
Any Suggestion Please Help
Thanks
Post a sample app with expected output....
Hi,
Try this.
A:
Load FieldA From XYZ;
Let vTableA = NoOfRows('A');
B:
Load FieldB From XYZ;
Let vTableB = NoOfRows('B');
Load $(vTableA)/$(vTableB) as Percentage
Autogenerate 1;
Drop table A,B;
Regards,
Kaushik Solanki
Do you mean to count them? in script?
LOAD Count(A) As CountA / Count(B) As Percentage
Resident Data;
Let vPercentage = Num(Peek('Percentage'), '0.0%');
Use Field Percentage or variable vPencentage.
try this in script @
Load Count(A)/Count(B) as percantage resident tablename;
Hie...
Load Count(A) / Count(B) As Percentage
Resident Data
Group By fieldname;
Regards,
Mohammad
Thank you so much Kaushik for you help
This is what i am looking for
Hi,
one solution to add a new field in the same table could be:
//test data generation
table1:
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
AutoGenerate 1100;
//Percentage field
Left Join (table1)
LOAD Num(Count(B)/Count(A),'0%') as Percentage
Resident table1;
hope this helps
regards
Marco