Skip to main content
SUBMITTED

Pivot and Unpivot

Related products:TimeXtender Data Integration
  • November 28, 2023
  • 5 replies
  • 91 views

Bernarddb
TimeXtender Xpert
Forum|alt.badge.img+6

In an old idea 5 years back from Bas Hopstaken, where he suggest to 

Add unpivot feature

I would like to add to this to add the Pivot function to. So you can do it both ways without having to create a view.

5 replies

devin.tiemens
TimeXtender Xpert
Forum|alt.badge.img+6
  • TimeXtender Xpert
  • November 28, 2023

I totally agree on this. Still waiting for this idea to be added to the “advanced features list”.


devin.tiemens
TimeXtender Xpert
Forum|alt.badge.img+6
  • TimeXtender Xpert
  • November 28, 2023

Here's the link to the idea of my colleague Bas

 


rory.smith
TimeXtender Xpert
Forum|alt.badge.img+8
  • TimeXtender Xpert
  • November 29, 2023

It would indeed be useful to have a transpose feature available to turn columns into rows and vice-versa.

Given that this is often applied against raw data it might be useful to automate this through ADF: https://learn.microsoft.com/en-us/azure/data-factory/data-flow-pivot / https://learn.microsoft.com/en-us/azure/data-factory/data-flow-unpivot . Qlik Sense has always had a nice visual way of doing this (CROSSTABLE LOAD).

On the other hand I have frequently seen expert opinion stating that this is a front-end problem and not something to be addressed in your database, though that may be stated from an OLTP bias. If you are unlucky enough to have to work against an EAV modelled system, this would be quite important.

I typically use SQL pivot/unpivot in the context of parent-child hierarchical data where there isn't really a generic way to approach this, but I think for transposing data it should be possible to come up with a generic feature.

 


Bernarddb
TimeXtender Xpert
Forum|alt.badge.img+6
  • Author
  • TimeXtender Xpert
  • June 5, 2024

I do agree with @rory.smith But in TX we often have to fix the performance issues from the front-end tools ;) so would be nice to have the possibilities to do it easier.


rvgfox
Problem Solver
Forum|alt.badge.img+4
  • Problem Solver
  • October 1, 2024

I am trying to apply to currency conversions and definitely need this feature.

As a solution we can use a custom view in TX as this:

The table DSA.EuroFXRef-Hist comes from:

https://www.ecb.europa.eu/stats/policy_and_exchange_rates/euro_reference_exchange_rates/html/index.en.html

And it’s like:

One column for each currency to convert to EUR.

But in my ERP I’ve only a few currencies (in the table DSA.Currencies:

With the view I can get the data unpivoted for only the curencies that we are using:

Hope this helps.