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: 
Not applicable

Swap two rows in pivot table

Hello there,

     My question is: Is there a way to swap two rows in pivot table?  Lets give the following example:

We got table:

Header 1Header 2Header 3Header 4
A123123das132a11223
B523123fgg2212asad
G123124sda51233311s
J123215f123f21312
Z1235555235dfd

Lets say Column 2 -> Header 2  is Expression or Calculated Dimension. Header 3 is expression too or Calc. Dimen. so is Header 4 too.

We got in Header 2:

=IF(above([Header 2])>[Header 2],.......swap ROW1 with ROW2 somehow............,[Header 2])

Thanks.

4 Replies
marcus_sommer

Not sure what you want to do? You want any kind of sorting-logic? If you want swap or replace some parts from rows its better done within the script - with previous() and/or peek() could you look into the values of other rows.

- Marcus

Not applicable
Author

I want to swap data in Row 1 (header 1 A) with data in Row 2 (header 1 B).

Anonymous
Not applicable
Author

You need to do that kind of transformation in the script side

marcus_sommer

Load your raw-data in qv then make a resident load over the first load to have the possibility to sort your data (order by statement) and the you could use peek() or previous() to compare and exchange the data from actual row with the from previous row respectively to n-rows.

- Marcus