Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

I am trying to do some calucation scripting, how would i do the following:

so attached is the spreadsheet, how do I match the ID in points to the ID in the data sheet and than for each company take the compscore and times it by the score in the points sheet.  After that I need to add up all the totals for each company.

5 Replies
Anonymous
Not applicable
Author

in the second table load, you can rename the field id to points that way, you have the correct association. QV will automatically associate the two tables. below is an example, use the correct field names you need and tweak as necessary!

script tab would look like:

Points:

LOAD id,
    
points
FROM
example.xlsx
(
ooxml, embedded labels, table is Points);

Data:
LOAD company,
    
id as points,
    
compscore
FROM
example.xlsx
(
ooxml, embedded labels, table is Data);

in a chart (bar or straight table would be best to start off), use dimension as company and expression as

sum(compscore*points).

test-score.png

ps: i misunderstood your requirement...you will have to use purgechar as Ajay mentioned.

Not applicable
Author

May be like attached.

Thanks

AJ

Not applicable
Author

I want the script to generate the product...
Not applicable
Author

How about this file.

Anonymous
Not applicable
Author

in that case, join the two tables in the above example by simply writing "join" after first table (Points) load and before second table (Data) load statements and then write the following after joining the tables in script:

NewTable:

LOAD *,
compscore*points as Product
Resident Points;

drop table Points;