Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
sunilkumarqv
Specialist II
Specialist II

Convert input format into Output

Hi Friends ,

need small help on  format change give examples on file   please check attached can we do in script

1 Solution

Accepted Solutions
MayilVahanan

Hi

Try like this

Table1:

LOAD * INLINE [

    Head, Data

    A, 12

    B, 15

    C, 16

    D, 54

    E, 40

    F, 12

];

Load 'Total' AS Head, Sum(Data) AS Data, 1 AS SortOrder Resident Table1 Where Match(Head, 'A', 'B', 'C', 'D') ;

Load *, RowNo() As SortOrder Resident Table1 Where Match(Head, 'A', 'B', 'C', 'D');

Load 'Total1' AS Head, Sum(Data) AS Data, 6 AS SortOrder Resident Table1 Where Match(Head, 'E', 'F');

Load *, RowNo() As SortOrder Resident Table1 Where Match(Head, 'E', 'F');

DROP Table Table1;

Head Data SortOrder
Total971
A122
B153
C164
D545
Total1526
E407
F128

Hope this helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

4 Replies
Ralf-Narfeldt
Employee
Employee

The information you are missing is how the Heads are grouped. Like:

Head          Group

A                Group1

B                Group1

C                Group1

D                Group1

E                Group2

F                Group2

If you can add that, you can load grouped on Group and get sub-totals

sunilkumarqv
Specialist II
Specialist II
Author

Hi Ralf ,

we need it in same like attached output

outcome should same as output table  can we do that in script

MayilVahanan

Hi

Try like this

Table1:

LOAD * INLINE [

    Head, Data

    A, 12

    B, 15

    C, 16

    D, 54

    E, 40

    F, 12

];

Load 'Total' AS Head, Sum(Data) AS Data, 1 AS SortOrder Resident Table1 Where Match(Head, 'A', 'B', 'C', 'D') ;

Load *, RowNo() As SortOrder Resident Table1 Where Match(Head, 'A', 'B', 'C', 'D');

Load 'Total1' AS Head, Sum(Data) AS Data, 6 AS SortOrder Resident Table1 Where Match(Head, 'E', 'F');

Load *, RowNo() As SortOrder Resident Table1 Where Match(Head, 'E', 'F');

DROP Table Table1;

Head Data SortOrder
Total971
A122
B153
C164
D545
Total1526
E407
F128

Hope this helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
sunilkumarqv
Specialist II
Specialist II
Author

Hi Mayil

Inline table if i bring other fields output table going for task