Results 1 to 3 of 3

Thread: PowerQuery: Inserting New Columns based on certain criteria

  1. #1
    Seeker Jose Fonyat's Avatar
    Join Date
    Aug 2017
    Location
    Brazil
    Posts
    10
    Articles
    0

    PowerQuery: Inserting New Columns based on certain criteria



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Dear members, let me know if you can help me with this problem:

    My table is the following:

    Customer IdCustomer Start End N.Days
    John 1 15/12/2017 18/12/2017 3
    Bruce 2 10/01/2017 12/01/2017 2






    My Goal is to achieve this new table:

    The idea is:
    - Create as many rows as the N.Days and repeat all content
    - Create a new column and insert the correspondent date of use (DayUse)

    Name IdCustomer Start End N.Days DayUse
    John 1 15/12/2017 18/12/2017 3 15/12/2017
    John 1 15/12/2017 18/12/2017 3 16/12/2017
    John 1 15/12/2017 18/12/2017 3 17/12/2017
    Bruce 2 10/01/2017 12/01/2017 2 10/01/2017
    Bruce 2 10/01/2017 12/01/2017 2 11/01/2017










    Thanks a lot
    Best Regards

  2. #2
    First, add a column with formula ={1..[N.Days]}
    You may use the default column name "Custom".
    Next, expand this column (2-arrows-button in the column header).
    Next, add a column "DayUse" with formula = Date.AddDays([Start],[Custom]-1).
    Finally, remove column "Custom".

  3. #3
    Seeker Jose Fonyat's Avatar
    Join Date
    Aug 2017
    Location
    Brazil
    Posts
    10
    Articles
    0
    Thanks a Lot Marcel!

    Best Regards!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •