# Pivot or unpivot?

**URL:** <https://community.easymorph.com/t/pivot-or-unpivot/5661>\
**Category:** General Q&A\
**Created:** [October 9, 2024, 7:17pm UTC](https://community.easymorph.com/t/pivot-or-unpivot/5661 "2024-10-09T19:17:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jorgenandreassen](https://community.easymorph.com/user_avatar/community.easymorph.com/jorgenandreassen/32/4112_2.png) [@jorgenandreassen](https://community.easymorph.com/u/jorgenandreassen)\
**Post date:** [October 9, 2024, 7:17pm UTC](https://community.easymorph.com/t/pivot-or-unpivot/5661/1 "2024-10-09T19:17:23Z")

</div>

I got this stupid file where every three columns should be converted to rows, the end result should be three columns, Agreement/Invoice number/Invoice date.  
I guess its an easy solution, but I'm stuck 😑

 ![image](https://community.easymorph.com/uploads/default/original/2X/6/6e5ba313fa0c67dcf34478d4625508e887e81b0c.png)

---

<div class="post-metadata">

**Author:** ![dgudkov](https://community.easymorph.com/user_avatar/community.easymorph.com/dgudkov/32/5_2.png) [@dgudkov](https://community.easymorph.com/u/dgudkov)\
**Post date:** [October 9, 2024, 8:20pm UTC](https://community.easymorph.com/t/pivot-or-unpivot/5661/2 "2024-10-09T20:20:08Z")

</div>

> Pivot or unpivot?

Both 🙂

Do unpivot first. Then modify the labels - remove the numbers from lables, so you only have three labels:

- Agreement
- Invoice number
- Invoice date

Put the removed number in a separate column.

Then do pivot with grouping by the column with numbers (the numbers will become rows).

---

<div class="post-metadata">

**Author:** ![jorgenandreassen](https://community.easymorph.com/user_avatar/community.easymorph.com/jorgenandreassen/32/4112_2.png) [@jorgenandreassen](https://community.easymorph.com/u/jorgenandreassen)\
**Post date:** [October 12, 2024, 5:50am UTC](https://community.easymorph.com/t/pivot-or-unpivot/5661/3 "2024-10-12T05:50:42Z")

</div>

Tried but does not get correct result, I should have columns as you write Agreement, Invoice number and Invoice date but cant figure it out.  
Attached the files if anyone wants to try.  
[Faktura ikke overført OS.morph](https://community.easymorph.com/uploads/short-url/9bRqafHz8lEmBJ1S2T4QeMLMA4O.morph) (58.6 KB)  
[Kundefakturaer ikke synket til Xledger.xlsx](https://community.easymorph.com/uploads/short-url/zbGzuJEkz3p72p2fD5c5TALZn8R.xlsx) (97.2 KB)

---

<div class="post-metadata">

**Author:** ![Jochen\_Marquardt](https://community.easymorph.com/user_avatar/community.easymorph.com/jochen_marquardt/32/5256_2.png) [@Jochen\_Marquardt](https://community.easymorph.com/u/Jochen_Marquardt)\
**Post date:** [October 12, 2024, 7:06am UTC](https://community.easymorph.com/t/pivot-or-unpivot/5661/4 "2024-10-12T07:06:23Z")

</div>

Please try this one.

[Faktura ikke overført OS.morph](https://community.easymorph.com/uploads/short-url/jF24Q56VjWj68hBj1XXQ63yfdrZ.morph) (67.1 KB)

---

<div class="post-metadata">

**Author:** ![jorgenandreassen](https://community.easymorph.com/user_avatar/community.easymorph.com/jorgenandreassen/32/4112_2.png) [@jorgenandreassen](https://community.easymorph.com/u/jorgenandreassen)\
**Post date:** [October 12, 2024, 7:30am UTC](https://community.easymorph.com/t/pivot-or-unpivot/5661/5 "2024-10-12T07:30:21Z")

</div>

Perfect, thanks!

---

<div class="post-metadata">

**Author:** ![Jochen\_Marquardt](https://community.easymorph.com/user_avatar/community.easymorph.com/jochen_marquardt/32/5256_2.png) [@Jochen\_Marquardt](https://community.easymorph.com/u/Jochen_Marquardt)\
**Post date:** [October 12, 2024, 7:55am UTC](https://community.easymorph.com/t/pivot-or-unpivot/5661/6 "2024-10-12T07:55:34Z")

</div>

Det var så lidt. 🙂
