Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
CreepyCatLady
Creator
Creator

Need to create a calculated field

Hello all. I need to create a calculated field in my data load that counts the number of items a user has. For example, if this were my table:

CreepyCatLady_0-1631547974248.png

The field (Count of Units) would provide this:

CreepyCatLady_1-1631548049499.png

I hope this makes sense; I don't even know where to start to accomplish this. 

1 Solution

Accepted Solutions
jwjackso
Specialist III
Specialist III


Detail:
load * Inline [
Unit,User
10025,usr1
10026,usr2
10027,usr3
10028,usr1
10029,usr1
10030,usr3
10031,usr4
];

Summary:
load User
,Count(Unit) as [Count of Units]
Resident Detail
group by User;

 

Capture.PNG

View solution in original post

4 Replies
jwjackso
Specialist III
Specialist III


Detail:
load * Inline [
Unit,User
10025,usr1
10026,usr2
10027,usr3
10028,usr1
10029,usr1
10030,usr3
10031,usr4
];

Summary:
load User
,Count(Unit) as [Count of Units]
Resident Detail
group by User;

 

Capture.PNG

CreepyCatLady
Creator
Creator
Author

Thank you! I do have a question though (it might be a stupid one, sorry if it is). The above was just an example to illustrate what I needed, but my actual data contains tens of thousands of users and items. I don't understand how to create an inline table in that case? 

jwjackso
Specialist III
Specialist III

I used the inline table to demonstrate the aggregation.  The resident command would refer to the table that you load in you script.

 

CreepyCatLady
Creator
Creator
Author

Ah, I understand now. Thank you so much!