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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic Straight/Pivot Table

Dear all,

I need help on the following issue.

Supposed I have the following data

folder    viewer_id admin_id owner_id

1    B0001    B0001    B0001

2    B0001    B0002    B0003

3    B0001    B0002    B0003

4    B0001    B0002    B0003

5    B0001    B0002    B0004

6    B0003    B0005    B0004

7    B0003    B0005    B0004

8    B0004    B0005    B0005

9    B0006     B0005    B0006

10    B0006    B0005    B0001

11    B0006    B0003    B0001

12    B0006    B0003    B0001

13    B0001    B0003    B0001

I have put viewer id as dimension and count(viewer id) as the the first expression. The result is as what i expect. However, for admin count and owner count, I still can't get the expected result even I have tried numerous script and expression. I wonder if it is feasible in qlikview. Thanks a lot

Expected result
idviewer countadmin countowner count
B0001615
B0006401
B0003233
1 Solution

Accepted Solutions
ecolomer
Master II
Master II

Here you are my proposal


Nada_4.png

View solution in original post

4 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Sample Script:

Data:

CrossTable(UserType, UserID)

LOAD

folder,

viewer_id AS Viewer,

admin_id AS Admin,

owner_id AS Owner

INLINE [

folder,viewer_id,admin_id, owner_id

1,B0001,B0001,B0001

2,B0001,B0002,B0003

3,B0001,B0002,B0003

4,B0001,B0002,B0003

5,B0001,B0002,B0004

6,B0003,B0005,B0004

7,B0003,B0005,B0004

8,B0004,B0005,B0005

9,B0006, B0005,B0006

10,B0006,B0005,B0001

11,B0006,B0003,B0001

12,B0006,B0003,B0001

13,B0001,B0003,B0001];

Create Straight table with the following

Dimension: UserID

Expressions:

Admin Count: Count({<UserType={'Admin'}>} UserID)

Viewer Count: Count({<UserType={'Viewer'}>} UserID)

Owner Count: Count({<UserType={'Owner'}>} UserID)

Hope this helps you.

Regards,

Jagan.

ecolomer
Master II
Master II

Here you are my proposal


Nada_4.png

Not applicable
Author

Thanks a lot for your help. Both of the solution help!

jagan
Partner - Champion III
Partner - Champion III

Please close the thread.

Regards,

Jagan.