Skip to main content
Contributor ⭐️⭐️
Feb 2, 2024 10:02 AM UTC
Solved

How to do Unpivot in Gainsight

Hi all,

 

I just want to understand if there a way to unpivot table (data) in Gainsight?

 

For example, if you look at this image; ID1 has values for ABC and XYZ and ID2 has only for DTE. Left hand side the data we have and on the right hand side is what we need to have

 

Thanks,

romihache
romihacheAnswer
VIP ⭐️⭐️⭐️⭐️⭐️
Feb 5, 2024 10:51 AM UTC

​​​@jigar.vyas 
I’m not sure if you can do anything else besides a multiple Union... 

Dataset 1, Transform. Select the name and first column. Rename it from ABC to version
Do a case evaluation, string output, call it Unpivot . If field ABC is not null, ABC, else null

Case to get the version and ABC field



Dataset 2 transform, repeat: select the name and second column. Rename it from XYZ to version
Add a a case evaluation, string output, call it Unpivot . If field XYZ is not null, YXZ, else null


 


 


Do this until all your columns are “unpivoted”. Union dataset 1 with 2, then that with 3. Having all your datasets with the same column names makes this part easier.
Do a last transform to filter version != null
 

final layout

 

Continuous improvement is better than delayed perfection

7 replies

spencer_engel
Expert ⭐️
Feb 2, 2024 2:28 PM UTC

I believe you’re asking a similar question as this? Maybe it will help 

 

 

Translate
Contributor ⭐️⭐️
Feb 5, 2024 9:36 AM UTC

@spencer_engel In the above example, all columns are combined in one, but that is not what I am trying to achieve. Basically, I am looking for unpivoting some columns.

Translate
romihache
romihacheAnswer
VIP ⭐️⭐️⭐️⭐️⭐️
Feb 5, 2024 10:51 AM UTC

​​​@jigar.vyas 
I’m not sure if you can do anything else besides a multiple Union... 

Dataset 1, Transform. Select the name and first column. Rename it from ABC to version
Do a case evaluation, string output, call it Unpivot . If field ABC is not null, ABC, else null

Case to get the version and ABC field



Dataset 2 transform, repeat: select the name and second column. Rename it from XYZ to version
Add a a case evaluation, string output, call it Unpivot . If field XYZ is not null, YXZ, else null


 


 


Do this until all your columns are “unpivoted”. Union dataset 1 with 2, then that with 3. Having all your datasets with the same column names makes this part easier.
Do a last transform to filter version != null
 

final layout

 

Translate
Continuous improvement is better than delayed perfection
Contributor ⭐️⭐️
Feb 6, 2024 10:09 AM UTC

@romihache I think you’re right. That’s the only way here though lengthy. Expected straight forward option like we have in excel using power query editor where can just select the columns to be unpivoted and select the option Unpivot Columns and everything is done in a few seconds. I wish Gainsight had it but they can take it a feature request.

Translate
romihache
VIP ⭐️⭐️⭐️⭐️⭐️
Feb 6, 2024 10:26 AM UTC

@jigar.vyas I couldn’t find an idea along those lines, you should submit one 🙃

Translate
Continuous improvement is better than delayed perfection
Contributor ⭐️⭐️
Feb 7, 2024 10:46 AM UTC

@romihache 

 

Translate
romihache
VIP ⭐️⭐️⭐️⭐️⭐️
Feb 7, 2024 11:04 AM UTC

Wonderful @jigar.vyas ! Upvoted!

Translate
Continuous improvement is better than delayed perfection