Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
CanOls
Contributor III
Contributor III

Grouping values in expression

Hi Qlik Community,

I would like some help with grouping four values from one dimension into two groups so that I can perform some analysis on them.

I have a field named 'fielfOfStudy' and it contains 4 different values, 'Science', 'Physics', 'English' and 'Social studies'.

I would like to create two groups, one that contain Science and Physics and one that contains the other two.

I've been messing around with the Aggr function but I can't quite find a solution. 

To give some context. I'm building a bar  chart that shows the % split between the two groups that I'm trying to build. I have the code down on that 100 % bar chart but I don't know how to group the values.

Any help is appreciated

Casper

Labels (5)
2 Solutions

Accepted Solutions
StarinieriG
Partner
Partner

Hi

try with this expression

=Aggr(If(Match(fielfOfStudy,'Science','Physics')>0,'Group 1','Group 2'),fielfOfStudy)

View solution in original post

jaibau1993
Partner
Partner

Hi! Just paste the expression provided by StarinieriG as a calculated dimension (not as expression).

Regards,

Jaime.

View solution in original post

4 Replies
StarinieriG
Partner
Partner

Hi

try with this expression

=Aggr(If(Match(fielfOfStudy,'Science','Physics')>0,'Group 1','Group 2'),fielfOfStudy)

View solution in original post

CanOls
Contributor III
Contributor III
Author

Thanks for your reply. 

The solution looks promising but I don't know how to implement it.

This is what I had beforehand. This creates a bar chart where each field's percentage split is show out of a hundred. Can you give me a hint as how to implement your solution in my expression so that I can perform it by the group basis?

= sum ( {<
  fieldOfStudy = {[Science] , [Physics] , [Englsh] , [Social studies] }  >} [studyData])
  
  /
  
  sum ( Total <Year> 

  {<

  fieldOfStudy = {[Science] , [Physics] , [Englsh] , [Social studies] }  >} [studyData])

 

Any help is appreciated

Casper

jaibau1993
Partner
Partner

Hi! Just paste the expression provided by StarinieriG as a calculated dimension (not as expression).

Regards,

Jaime.

View solution in original post

CanOls
Contributor III
Contributor III
Author

That did the trick.

I appreciate that.