6 Replies Latest reply: Apr 24, 2015 3:25 PM by Michael Tarallo

# How do you create a group out of a calculation?

Hello!

This is my first post and my first time using Qlik Sense so hopefully I've come to the right place!

I'm working with social media data, and within the data set, I have people who've mentioned my brand from 1 - 500 times. I'd like to group these as different sets:

Group A: mentioned brand 100 - 500 times

Group B: mentioned brand 25 - 99 times

Group C: mentioned brand 12 - 24 times

Group D: mentioned brand 6 - 11 times

The data simply lists all the mentions so the 'people' column in the data set will have duplicate records.

Not only do I want to group these people, I'd like to know how many people are in each group as a KPI and how many total mentions each group has.

Any help would be appreciated.

• ###### Re: How do you create a group out of a calculation?

Can you post your script or an example qvw?

• ###### Re: How do you create a group out of a calculation?

"Query Id",

"Query Name",

"Date",

Title,

Snippet,

Url,

Domain,

Sentiment,

"Page Type",

Language,

//     "Country Code",

//     "Continent Code",

Continent,

Country,

//     "State Code",

//     "County Code",

//     "City Code",

Notes,

"Account Type",

Assignment,

"Author",

This is the expression I used in a bar chart to show me the mentions by author for a group:

if( Count(Author)>99,

null(),

if( Count(Author)<25, null(),

Count(Author)))

I want to make this group a dimension.

• ###### Re: How do you create a group out of a calculation?

try the following approach (you must edit FROM stetement with your source definition):

MyTable:
"Query Id",
"Query Name",
"Date",
Title,
Snippet,
Url,
Domain,
Sentiment,
"Page Type",
Language,
// "Country Code",
//     "Continent Code",
Continent,
Country,
// "State Code",
//     "County Code",
//     "City Code",
Notes,
"Account Type",
Assignment,
"Author"
FROM [...];

Left Join (MyTable)
CalculationTable:
Author,
if(TotalMentions <= 11, 'D',
if(TotalMentions > 11 and TotalMentions <= 24, 'C',
if(TotalMentions > 24 and TotalMentions <= 99, 'B',
if(TotalMentions > 99, 'A'
))))
as AuthorClass;
Author,
Count(Author) as TotalMentions
Resident MyTable
Group By Author;

• ###### Re: How do you create a group out of a calculation?

You can use dimension AuthorClass in front end envirorment and apply, for example, the expression Count(Author) or Count(DISTINCT Author) to perform calculation.

• ###### Re: How do you create a group out of a calculation?

That's great! Worked a treat. Cheers Carlo!

• ###### Re: How do you create a group out of a calculation?

HI Tara - there is also a video on this topic here Qlik Sense - Dimension Grouping (video) that shows this process defined in the master items vs the load script:

That video is part of a subset of other videos that can help you will Qlik Sense.

New to Qlik Sense Videos