Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

CanOls
New 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

2 Solutions

Accepted Solutions
Partner
Partner

Re: Grouping values in expression

Hi

try with this expression

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

View solution in original post

Partner
Partner

Re: Grouping values in expression

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

Regards,

Jaime.

View solution in original post

4 Replies
Partner
Partner

Re: Grouping values in expression

Hi

try with this expression

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

View solution in original post

CanOls
New Contributor III

Re: Grouping values in expression

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

Partner
Partner

Re: Grouping values in expression

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

Regards,

Jaime.

View solution in original post

CanOls
New Contributor III

Re: Grouping values in expression

That did the trick.

I appreciate that.