Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
newqlik2017
Creator II
Creator II

Sum of rows based on a group in load script

Hello,

Below is my data set. I'm looking to group the account by state based on groups in the load script.

Also, how can I include the County, City, Zip columns in the final result set. Attached is a qvw for reference.

Data set:  

STATECOUNTYCITYZIPACCOUNTGROUPAMOUNT
CANAPAXXX1001A123Low100
CANAPAYYY1002A123Low200
CAMONOAAA1003A123High300
CAORANGEBBB1004A123Medium400
NYSUFFOLKAAA2001A123Low50
NYSUFFOLKBBB2002A123Low70
NYSUFFOLKBBB2002A123High90
PABUTLERCCC3001A123Low110
PACOLUMBIADDD3002A123Low120
PACLINTONAAA3003A123Low130
PACLINTONAAA3003A123High140
PACLINTONBBB3004A123Medium

150

Expected Result (also need to include County, City, Zip somehow as a part of final data set so that users can filter based on the state, county, city and zip):  

STATEACCOUNTGROUPAMOUNT
CAA123LOW300
CAA123MEDIUM400
CAA123HIGH300
NYA123LOW120
NYA123HIGH90
PAA123LOW360
PAA123MEDIUM150
PAA123HIGH140

 

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Simply adding this?

Right Join(Table)

LOAD STATE, ACCOUNT, GROUP, Sum(AMOUNT) as AMOUNT Resident Table Group By STATE, ACCOUNT, GROUP Order By GROUP;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

7 Replies
Anil_Babu_Samineni

Can you add this at end, And check..

Final:

NoConcatenate

LOAD STATE, ACCOUNT, GROUP, Sum(AMOUNT) as AMOUNT Resident Table Group By STATE, ACCOUNT, GROUP Order By GROUP;

DROP Table Table;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
jaumecf23
Creator III
Creator III

I have attached an example. Check if this is usefull for you.

newqlik2017
Creator II
Creator II
Author

Jaume, did you attach a different test.qvw file?

newqlik2017
Creator II
Creator II
Author

Thanks Anil. That works.

Now, how do I bring in other columns County, City and Zip in the UI. Any ideas?

jaumecf23
Creator III
Creator III

Yes, my mistake. I have update the older message with the correct file.

Anil_Babu_Samineni

Simply adding this?

Right Join(Table)

LOAD STATE, ACCOUNT, GROUP, Sum(AMOUNT) as AMOUNT Resident Table Group By STATE, ACCOUNT, GROUP Order By GROUP;

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anil_Babu_Samineni

I suggest you to close this thread by flag "Correct Answer"

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful