Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
DyadyaFedor
Contributor III
Contributor III

grouping articles

In my app, I have a pivot table that looks like this:

Name    Age

Mary      10

Ann        11

Jane      12

Jack       3

John      6

Peter     5

I need to group Girls and Boys to have something like

Girls    33

Boys    14

 

The entire list of names is pretty long. Is there a more elegant way to write the formula then repeating if statement?

Thank you very much in advance

 

 

 

 

Labels (1)
2 Replies
Anil_Babu_Samineni

I would recommend to create mapping table like

Name, Gender

Mary, Female

Ane, Female

Jane, Male

Jack, Male

...

And then, Use expression to restrict that with Gender as dimension

Also, There should mapping field in databased otherwise we can't justince gender by seeing name

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
rubenmarin

Hi  @DyadyaFedor, if you have a table or list with Name and genre you can use a mapping or a join to merge both values:

mapGenreGroup:
Mapping LOAD
  Name,
  GenreGroup
Resident/From...;

DataTable:
LOAD
  Name,
  ApplyMap('mapGenreGroup', Name, Null()) as GenreGroup,
  OtherFields...
From/Resident...;

Using ths you only need to update the list of the mapping table to add new names, this will be better if it's loaded from a table on database, or an excel or as last option having the names listed as an inline table

mapGenreGroup:
Mapping LOAD * Inline [
Name     ,GenreGroup
Mary     ,Girls
Jack     ,Boys
...
];