locked
Create column with minimum value of other column RRS feed

  • Question

  • Hi there,

    I have a table of deliveries per SKU. For every delivery of a SKU one line is being created with SKU, delivery date, quantity. So for every SKU there can be more lines depending on the amount of deliveries:

    SKU     Qty     Delivery Date

    123      5        01.01.2019

    123      5        01.02.2019

    124      10      01.03.2019

    Now i want to create another column showing always the first delivery date for each SKU. So in this case it should show for SKU 123 always 01.01.2019 in that column. How can i do that in power query?

    Thank you!

    Tuesday, February 4, 2020 2:28 PM

Answers

  • Hi Henrik,

    Use this code:

    let
        Source = Excel.CurrentWorkbook(){[Name="Table"]}[Content],
        group = Table.Group(Source, "SKU", {"min", each List.Min([Delivery Date])}),
        join = Table.Join(Source,"SKU",group,"SKU")
    in
        join
    • Edited by Aleksei Zhigulin Tuesday, February 4, 2020 4:26 PM
    • Proposed as answer by Lz._ Friday, February 7, 2020 2:05 PM
    • Marked as answer by Imke FeldmannMVP Monday, February 24, 2020 9:58 PM
    Tuesday, February 4, 2020 4:25 PM