Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

How to merge similar rows

Hi Friends,

I have data like this

Inline

[

  A, B, C, Code, Amount

  1, 2, 3, PC, 900

  1,2,3,PC,900

  1, 3, 4, PM,  800

  1, 2, 4, TM, 800

  1, 2, 6, PC, 800

  ]

I have to merge first two rows and amount should be 1800.

Thanks

Tags (1)
1 Solution

Accepted Solutions

Re: How to merge similar rows

Hi

Try like this

Load A,B,C, Sum(Amount) as Amount, Code Group by A,B,C, Code;
Load * inline
[
  A, B, C, Code, Amount
  1, 2, 3, PC, 900
  1,2,3,PC,900
  1, 3, 4, PM,  800
  1, 2, 4, TM, 800
  1, 2, 6, PC, 800
  ]
;

4 Replies
martinpohl
Valued Contributor II

Re: How to merge similar rows

Create a straight table chart.

Add fields A, B, C and Code as dimension

Create a formula sum(Amount)

This will show you the wanted value.

Regards

MVP
MVP

Re: How to merge similar rows

In the front -end if you use aggregation function Sum() with other dimensions in a chart you get it as you want. If you are looking for script solution try like:

Input:    

Inline

[

  A, B, C, Code, Amount

  1, 2, 3, PC, 900

  1,2,3,PC,900

  1, 3, 4, PM,  800

  1, 2, 4, TM, 800

  1, 2, 6, PC, 800

  ];

NoConcatenate

Final:

Load

          A,

          B,

          C,

          Code

          Sum(Amount) as Amount

Resident Input Group By A, B, C, Code;

Drop Table Input;

Re: How to merge similar rows

Hi,

Create New Chart --> Straight Table

Dimension

A

B

C

Code

Expression

=sum(Amount)

Regards

ASHFAQ

Re: How to merge similar rows

Hi

Try like this

Load A,B,C, Sum(Amount) as Amount, Code Group by A,B,C, Code;
Load * inline
[
  A, B, C, Code, Amount
  1, 2, 3, PC, 900
  1,2,3,PC,900
  1, 3, 4, PM,  800
  1, 2, 4, TM, 800
  1, 2, 6, PC, 800
  ]
;

Community Browser