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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

select expression values

Hi everyone,

        i have a chart with this expressions:

Count(DISTINCT (if(USERS_ENRICHED.age > 21 and USERS_ENRICHED.age <= 29, USERS_ALL.u_user_id))) = 30.000

Count(DISTINCT (if(USERS_ENRICHED.age >= 18 and USERS_ENRICHED.age <= 21, USERS_ALL.u_user_id))) = 15.000

Count(DISTINCT (if(USERS_ENRICHED.age > 30 and USERS_ENRICHED.age <= 35, USERS_ALL.u_user_id))) = 5.000

and i need to know who is in each group.

the problem is: i can't select or do a click over this expressions to know which user is in each group. I have a workaround but the question is if there is any way to select an expression value.

tell me if im not clear

thanks

gerardo

4 Replies
Not applicable
Author

Have you tried to put an expression or mapping in the data load so that you can easily display handle the "age group" as a dimension (multiple benefits including speed) to see the counts as well as have a drill down or show a details table/straight table?

Not applicable
Author

Hi daltonruer,

       can you give me an example about "mapping in the data load...."? i've never do that.

thanks

gerardo

MayilVahanan

HI

Try like this

Load * , if(USERS_ENRICHED.age >=18 and USERS_ENRICHED.age <= 21,'18-21',

if(USERS_ENRICHED.age >21 and USERS_ENRICHED.age <= 29,'22-29',

if(USERS_ENRICHED.age >=30 and USERS_ENRICHED.age <= 35,'30-35'))) as Age from table;

Then use Age as dimension,

and use

Count(DISTINCT USERS_ALL.u_user_id)))  as expression.

Hope it helps to create a age bucket in script.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Sure. I've included some sample inline statements below. Notice first table is your "dimension" a simple way to "group" individual ages into the groups/target audiences you are looking for. You would need to map as many ages as you like and you could use different categories. The "Age" field would automatically be associated between the two tables so that you can easily get to the people in the Age_Group. You can also use the Age_Group and Age as part of a Drill Down group for your application and Chart. Your Chart Expression would be =Count(Name) and would start with the #'s for the groups. But if you clicked on a group you could see the counts by the ages that make up that group. Or you can simply use a Pivot Table instead of a chart that would handle the drill downs. You could see the subtotals for each group, and then click on the + sign in the pivot table to view the people. You could get fancy and use the chart to view the #'s pretty by group, and offer the Fast Change to get down to the people inside the pivot. But using the data model as the place holder for things like this allows you to fire the expression/join 1 time, but refer to the data without CPU costs for the end users.

Age_Group:
LOAD * INLINE [
    Age, Age_Group
    1, Infant
    2, Infant
    3, Infant
    4, Infant
    5, Child
    6, Child
    7, Child
    8, Child
    9, Child
    10, Adolescent
    11, Adolescent
    12, Adolescent
    13, Teenager
    14, Teenager
];

People:
LOAD * INLINE [
    Name, Age
    Bob, 2
    Fred, 12
    Sally , 13
    Brenda, 14
    Harry, 3
    Samuel, 10
    Barney, 11
];