Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to solve the need for aggregation in a calculated dimension?

Hi there:

I'm trying to create a calculated dimension based on a check on multiple underlying records.

source records:

Project Status

1 Assigned

1 Released

1 Transferred

2 Assigned

2 Locked

2 Released

2 Transferred

3 Assigned

3 Created

3 Transferred

As you can see, each project has multiple statuses.

I would ike to make a new dimension with the following rules:

Active --> if project has a status 'Released' but no 'Locked'

Non active --> if project has a status 'Locked' or no 'Released'

Result then should be :

Project Activation

1 Active

2 Non Active

3 Non Active

And of course we should be able to select all Active projects or non-active projects etc..

What is the best way to achieve this?



1 Solution

Accepted Solutions
Not applicable
Author

It is probably better to determine the actie/non-active status during the loading of the data. But the following could be a calculated dimension

=if (substringcount(aggr(Concat(Status),Project),'Released')=1,if (substringcount(aggr(Concat(Status),Project),'Locked')=1,'Non-Active' ,'Active'),'Non-Active')

in a table it would look like

Project Activation =aggr(Concat(Status),Project) Sum (Cnt)
65
1ActiveAssignedReleasedTransferred9
2Non-ActiveAssignedLockedReleasedTransferred26
3Non-ActiveAssignedCreatedTransferred30




Hope this answers your question



View solution in original post

3 Replies
Not applicable
Author

Seems you already got the answer to it!:)
Just use an if condition in the script as follows:
if(Project=1, 'Active','Non Active") as Flag_Project_Activation
Now you can use this Flag_Project_Activation in the front end to make selections and appropriate Status will be selected..

1 Released

2 Locked

2 Released

Here Project status is Locked as well as released?

Which Activation category will this Project fall under?



Not applicable
Author

It is probably better to determine the actie/non-active status during the loading of the data. But the following could be a calculated dimension

=if (substringcount(aggr(Concat(Status),Project),'Released')=1,if (substringcount(aggr(Concat(Status),Project),'Locked')=1,'Non-Active' ,'Active'),'Non-Active')

in a table it would look like

Project Activation =aggr(Concat(Status),Project) Sum (Cnt)
65
1ActiveAssignedReleasedTransferred9
2Non-ActiveAssignedLockedReleasedTransferred26
3Non-ActiveAssignedCreatedTransferred30




Hope this answers your question



Not applicable
Author

Thanks Jan,

Your suggestion works great!