Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
xyz_1011
Partner - Creator
Partner - Creator

sum() aggr() group by...

Hi all,

its probably quite obvious, but i am fiddling around with the below for some time now and cant get it to work. I have the following (excerpt of my) data set:

Batch_ID Item Weight Referral Relevance
XX A 16,00% 100,00% 16,00%
XX B 11,00% 0,00% 0,00%
XX C 17,00% 40,00% 6,80%
XX D 2,00% 100,00% 2,00%
XX E 6,00% 100,00% 6,00%
XX F 12,00% 100,00% 12,00%
XX G 2,00% 0,00% 0,00%
XX H 25,50% 40,00% 10,20%
XX I 8,50% 25,00% 2,13%
         
        55,13%

 

I am trying to load (in my script) the data above and have it grouped by Batch_ID. For some reason i never get to the 55.13% for the given Batch_ID above (which i have sone in XLS by summing up the column "Relevance") - Any hint would be much appreciated.

Thanks!!

Labels (2)
4 Replies
marcus_sommer

Add a recno() and rowno() to the load and pull these information with the other fields into a table-box to have a look on the really loaded data.

LRuCelver
Partner - Creator III
Partner - Creator III

Data:
NoConcatenate Load
	*,
    Weight * Referral as Relevance
Inline [
	Batch_ID, Item, Weight, Referral
    XX, A, 0.16, 1
    XX, B, 0.11, 0
    XX, C, 0.17, 0.4
    XX, D, 0.02, 1
    XX, E, 0.06, 1
    XX, F, 0.12, 1
    XX, G, 0.02, 0
    XX, H, 0.255, 0.4
    XX, I, 0.085, 0.25
];

Batch_Relevance:
NoConcatenate Load
	Batch_ID,
    Sum(Relevance) as Batch_Relevance
Resident Data
Group By Batch_ID;
ali_hijazi
Partner - Master II
Partner - Master II

Qlik shows on a table the distinct values
so if you have two rows in the source data with same values then Qlik on a table displays one of them
to make sure that this is what is happening, you need to add a new column to your data as follows:
Load *, rowno() as unique_id...
add this column (unique_id) to your table and you must see duplicate rows except for the unique id you added

Otherwise you need to share sample data / qvf file to do more investigations

I can walk on water when it freezes
Dataintellinalytics

Please share the raw data along with formula used in both Excel and Qlik