Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

operation with tmap or taggregate, calculation

Hi
could anybody help?
I have a file like this:
ID F. No.1 No.2 No.3
A 3 1 1
B 2 1 1
C 4 1 1 1
A 3 1 1
A 2 1 1

in the end I want to have this: Rows which have the same ID and F. should go together
ID F. No.1 No.2 No.3
A 3 1 1 1
B 2 1 1
C 4 1 1 1
A 2 1 1
Could this be solved with t-map or taggreaterow ?
Labels (2)
4 Replies
Anonymous
Not applicable

In the aggregation, which operation do you want to perform? because for ID-A, f-3, No.2 should be 2 if you sum. So, do you want a "exists" function ?
Anonymous
Not applicable

Hello Ham
Does the value of 'No1..NO3' always be empty or '1'? if so ,you can use the max function, here is a scenario:
input file:
a;3;1;1;
b;2;;1;1
c;4;1;1;1
a;3;;1;1
a;2;;1;1
result;
Starting job forum5928 at 21:57 23/03/2009.
ID: c|F: 4|NO1: 1|NO2: 1|NO3: 1
ID: a|F: 3|NO1: 1|NO2: 1|NO3: 1
ID: a|F: 2|NO1: |NO2: 1|NO3: 1
ID: b|F: 2|NO1: |NO2: 1|NO3: 1
Job forum5928 ended at 21:57 23/03/2009.

Best regards

shong
_AnonymousUser
Specialist III
Specialist III
Author

An existing-function sounds good.
I tried with taggregate. But the result is false. It counts the number of equal IDs, but not the number of No.1, No.2.... for each ID with it F.
Could you explain taggregate to me?
Anonymous
Not applicable

An existing-function sounds good.

btlink
Could you explain taggregate to me?

For a description of tAggregateRow, please check the documentation user guide.
Here comes an example of to perform your job, without the "exists" aggregation function, the trick is to perform a sum, and then reduce to undef or 0. The output of my job is:
Starting job topic5928 at 15:03 24/03/2009.
.--------------------------.
| tLogRow_1 |
+----+---+-----+-----+-----+
| id | f | no1 | no2 | no3 |
+----+---+-----+-----+-----+
| A | 3 | 1 | 1 | 1 |
| A | 2 | | 1 | 1 |
| C | 4 | 1 | 1 | 1 |
| B | 2 | | 1 | 1 |
'----+---+-----+-----+-----'
===
execution time: 15 milliseconds
===
Job topic5928 ended at 15:03 24/03/2009.