Forum Discussion

gancw1's avatar
gancw1
Resolver II
4 years ago
Solved

Unpivot and date fill

I have the data in this format 

 

IDSNItem DescriptionStart DateMonth 1Month 2Month 3
1101 Printer cartridge1 Apr 202010200
1112Ruler1 Nov 202020305

 

How do I unpivot and fill in the month so that the table looks like this

 

IDSNItem DescriptionStart DateMonthQuantity
110178 Printer cartridge1 Apr 20201 Apr 202010
110178 Printer cartridge1 Apr 20201 May 202020
110178 Printer cartridge1 Apr 20201 Jun 20200
1112Ruler1 Nov 20201 Nov 202020
1112Ruler1 Nov 20201 Dec 202030
1112Ruler1 Nov 20201 Jan 20215

 

2 Replies

  • jppv20's avatar
    jppv20
    Solution Sage

    Hi gancw1 ,

     

    First select columns "ID", "SN", "Item Description", "Start Date" and choose unpivot other columns.
    Then create a new column with this formula:

    Month =

    Date.AddMonths([Start Date],Number.FromText(Text.End([Attribute],1))-1)

     

    If I answered your question, please mark it as a solution to help other members find it more quickly.