Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
vimalthehero
Contributor III
Contributor III

summarize Data transformation logic

I'm trying to transform data to table which summaries the total occurrence count of each values.

can someone put some light on it?

input data

Input Data
Field1 Field2 Field3 Field4
B A C D
A B F X
C A F H
A B C D
D E F A

 

 

Expected output

Output
A 5
B 3
C 3
D 3
E 1
F 3
X 1

 

data transformation.JPG

Labels (1)
1 Solution

Accepted Solutions
RsQK
Creator II
Creator II

Hi, this:

input_data:
LOAD 1 as temp_qualifier_field ,* INLINE [
Field1|Field2|Field3|Field4
B|A|C|D
A|B|F|X
C|A|F|H
A|B|C|D
D|E|F|A
] (DELIMITER IS '|');

temp_output:
CROSSTABLE(field_from,values,1)
LOAD * RESIDENT input_data;

output:
LOAD
values,
COUNT(values) AS occurance_count
RESIDENT temp_output
GROUP BY values;

DROP TABLE temp_output;
DROP FIELD temp_qualifier_field;

View solution in original post

2 Replies
RsQK
Creator II
Creator II

Hi, this:

input_data:
LOAD 1 as temp_qualifier_field ,* INLINE [
Field1|Field2|Field3|Field4
B|A|C|D
A|B|F|X
C|A|F|H
A|B|C|D
D|E|F|A
] (DELIMITER IS '|');

temp_output:
CROSSTABLE(field_from,values,1)
LOAD * RESIDENT input_data;

output:
LOAD
values,
COUNT(values) AS occurance_count
RESIDENT temp_output
GROUP BY values;

DROP TABLE temp_output;
DROP FIELD temp_qualifier_field;
vimalthehero
Contributor III
Contributor III
Author

Thanks its works, is it possible to perform similar output using chart expression  instead of script data loading?