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: 
Not applicable

Expressions in charts

Hello,

I have the following problem:

I have two tables: 1. Users and 2.Events. They have a common field called user_id, and I am trying to make a straight table to see all the information of the users and the events (clics) they have done.

[Users]

Name

email

user_id

[Events]

user_id

type_of_clic

clic_id (consecutive number)

So I want to display a chart with the fields: Name, email, and # of clics per type (clic_type1, clic_type 2, clic_type3, clic_type4).

To calculate the # of clics per type I am using these expressions:

clic_type1:

= if (type_of_clic=1,count(clic_id))

clic_type2:

= if (type_of_clic=2,count(clic_id))

clic_type3:

= if (type_of_clic=3,count(clic_id))

clic_type4:

= if (type_of_clic=4,count(clic_id))

I am only getting 1 row (one user) as a result in my table, and I should be getting 3 rows of results.

Thank you,

Juan.

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You could use four expressions like

count({<type_of_clic={1}>} clic_id)

count({<type_of_clic={2}>} clic_id)

count({<type_of_clic={3}>} clic_id)

count({<type_of_clic={4}>} clic_id)

Or you could use a pivot table, add type_of_clic as a dimension and drag it to the top right so that it gets displayed horizontally. Then you only need one expression count(clic_id)


talk is cheap, supply exceeds demand

View solution in original post

3 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Can you post a sample file or screen shot of your chart?

You need set analysis i think.

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

You could use four expressions like

count({<type_of_clic={1}>} clic_id)

count({<type_of_clic={2}>} clic_id)

count({<type_of_clic={3}>} clic_id)

count({<type_of_clic={4}>} clic_id)

Or you could use a pivot table, add type_of_clic as a dimension and drag it to the top right so that it gets displayed horizontally. Then you only need one expression count(clic_id)


talk is cheap, supply exceeds demand
Not applicable
Author

Hi Gysbert,

The first option worked!

Thank you for your help.

Juan.