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: 
qvdrago
Contributor III
Contributor III

Similar to crossover table

Hi, 

I have a table with several records, every record has a field 'Season' that can contain values like: 'W20', 'W21', 'W22', 'W23', 'S20', 'S22', 'S23', 'S24'...

where 'W' stays for 'Winter' and 'S' stays for 'Summer'.

I'd like to create a summary table like this:

 

Group, Season1, Season2, Season3, Season4

Summer, S24, S23, S22, S20

Winter, W23, W22, W21, W20

 

Thank you.

Labels (1)
2 Solutions

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

How about:

Data:
LOAD * Inline [
Season
W20
W21
W22
W23
S20
S21
S22
S23
S24
];
 
SeasonMap:
Mapping Load * Inline [
Code, Season
W, Winter
S, Summer
];
 
Groups:
Generic Load Group, SeasonSeq, Season
;
Summary:
LOAD *,
'Season' & AutoNumber(Season, Group) as SeasonSeq
;
LOAD
Season,
ApplyMap('SeasonMap',left(Season, 1)) as Group
Resident Data
Order By Season DESC
;
 
If you need to join the Groups tables into a single table see: https://qlikviewcookbook.com/2010/05/use-cases-for-generic-load/
 

View solution in original post

qvdrago
Contributor III
Contributor III
Author

Many Thank Rob. 

Work perfectly 

You are always the best !!!

Just for information .... Which function should I use to bring data horizontally ???

Many thansk

 

 qvdrago_0-1695629755359.png

 

 

 

 

 

View solution in original post

7 Replies
anat
Master
Master

can you post  your actual source data format and sample records ?

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

How about:

Data:
LOAD * Inline [
Season
W20
W21
W22
W23
S20
S21
S22
S23
S24
];
 
SeasonMap:
Mapping Load * Inline [
Code, Season
W, Winter
S, Summer
];
 
Groups:
Generic Load Group, SeasonSeq, Season
;
Summary:
LOAD *,
'Season' & AutoNumber(Season, Group) as SeasonSeq
;
LOAD
Season,
ApplyMap('SeasonMap',left(Season, 1)) as Group
Resident Data
Order By Season DESC
;
 
If you need to join the Groups tables into a single table see: https://qlikviewcookbook.com/2010/05/use-cases-for-generic-load/
 
qvdrago
Contributor III
Contributor III
Author

Many Thank Rob. 

Work perfectly 

You are always the best !!!

Just for information .... Which function should I use to bring data horizontally ???

Many thansk

 

 qvdrago_0-1695629755359.png

 

 

 

 

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Can you show an example of whaat you mean by "bring data horizontally"?

-Rob

qvdrago
Contributor III
Contributor III
Author

Data:
LOAD * Inline [
Season
W20
W21
W22
W23
S20
S21
S22
S23
S24]
 
Transform to
 
qvdrago_0-1695725888435.png

 

 
qvdrago
Contributor III
Contributor III
Author

Hi Rob

Thank you for your time

 

Data:
LOAD * Inline [
Season
W20
W21
W22
W23
S20
S21
S22
S23
S24]
 
Transform all data in 2 lines 
 
qvdrago_1-1695726029767.png

 

Regards

Clod

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

It is the "Generic" prefix that transforms from rows (vertical) to columns (horizontal).

https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptPrefixes...

-Rob