Power Query - Pivoting Stacked Data

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2024

ความคิดเห็น • 42

  • @IvanCortinas_ES
    @IvanCortinas_ES 2 วันที่ผ่านมา

    Absolutely pro-solutions, as always. Thank you for sharing them!!!

    • @bcti-bcti
      @bcti-bcti  2 วันที่ผ่านมา

      @@IvanCortinas_ES My pleasure. Thanks for watching!

  • @kkravch
    @kkravch 2 วันที่ผ่านมา

    Thank you, Professor. Great explanation.

    • @bcti-bcti
      @bcti-bcti  2 วันที่ผ่านมา

      @@kkravch Thank you! Now go out and conquer the world.

  • @iankr
    @iankr 3 วันที่ผ่านมา +2

    Excellent techniques, clearly explained. Many thanks.

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา +1

      @@iankr Thank you. Could you tell I have a head cold?

  • @adamtabor6754
    @adamtabor6754 3 วันที่ผ่านมา

    Excellent solution and explanation.

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา

      Thank you. Many viewers are contributing some AMAZING alternate solutions. Check out some of the great ideas in the comments.

  • @scotolivera8207
    @scotolivera8207 3 วันที่ผ่านมา +2

    helpful, wraprows also could be used as well here

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา

      Yes; many viewers are contributing some AMAZING alternate solutions. Check out some of the other replies for ideas similar to your own. Thanks for watching.

  • @chrism9037
    @chrism9037 3 วันที่ผ่านมา

    Excellent, thank you!

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา

      Thank you very much. We greatly appreciate your support and engagement.

  • @jawadahmadehssan6251
    @jawadahmadehssan6251 3 วันที่ผ่านมา

    Thank you for the great content as always

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา

      My pleasure! Thanks for watching.

  • @alperkins66
    @alperkins66 วันที่ผ่านมา

    While the right click to import data as a Table works beautifully. I find having a Quick Access icon with Table import is my best option for bringing in Tables. Thank you for your outstanding work on Power Query, etc.

    • @bcti-bcti
      @bcti-bcti  วันที่ผ่านมา

      I agree 100% I love customizing my QAT. Have you seen my video on the "Complete Guide to the QAT"? Check it out; I bet there are some tricks you may not have known. Cheers.
      th-cam.com/video/GEv7_AHtv-w/w-d-xo.html

  • @Bhavik_Khatri
    @Bhavik_Khatri 3 วันที่ผ่านมา

    Solution 2 is quite impressive. I appreciate you sharing it.

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา

      @@Bhavik_Khatri My pleasure. Thanks for watching.

  • @arnyanderson4955
    @arnyanderson4955 3 วันที่ผ่านมา

    Really waiting your new tutorials, always found amazing and excellent and yes applicable to working world
    Hats off

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา

      @@arnyanderson4955 Thank you! It’s nice to feel appreciated. Cheers!

  • @tinhoyhu
    @tinhoyhu 3 วันที่ผ่านมา +4

    =wraprows(filter(sales, sales""), 4)
    Safer, in case of empty cells in data:
    =TAKE(WRAPROWS(SALES, 5),,4)

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา +1

      That is an EXCELLENT way of solving the problem using Dynamic Array functions. I love DA functions!!! When I use DA function for this, I am not getting the rank for the first entry ("McDonald's") to display. What about you? This is odd. Trying to figure out why. Thanks for your great solution!!!

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา

      When I recreated the data in a new file, I didn't have the problem of the missing first rank. But no matter where I put that formula in the download file, the first rank is blank. "1" show up in the formula audit trail, but not in the displayed output. This is very odd, indeed.

    • @tinhoyhu
      @tinhoyhu 3 วันที่ผ่านมา +1

      It works in the download file for me. This is with Excel on Android.

    • @ursula9875
      @ursula9875 3 วันที่ผ่านมา

      :)

    • @tinhoyhu
      @tinhoyhu 3 วันที่ผ่านมา

      @@bcti-bcti yes, the dynamic array functions have really changed the way I tackle problems in Excel. Each tool has its strengths, so it'd be cool if PQ could evaluate excel functions, like how Excel could call python to return a dataset.
      For example, EXCEL(table_reference, "=TAKE(WRAPROWS (table_reference, 5),,4)").
      Would probably be a nightmare on query folding though.

  • @ismaelkourouma5558
    @ismaelkourouma5558 3 วันที่ผ่านมา

    Excellent.
    Do you use Camtasia for your videos?

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา

      @@ismaelkourouma5558 Yes. Is it that obvious? 🤣

  • @RichardJones73
    @RichardJones73 3 วันที่ผ่านมา

    Thanks for the handy little tips, especially the non conversion of data to a table by naming the range

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา

      I love that trick! I wish that was a behavior we could turn off in the PQ settings. Thanks for watching.

  • @billhladik406
    @billhladik406 3 วันที่ผ่านมา

    Always good to know PQ stuff, but easier for this example:
    =INDEX(A1:A254,SEQUENCE(ROWS(A1:A254)/5,5))

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา

      I like your thinking! I've made an adjustment to the formula to discard the column of zeroes (blank rows in source).
      =DROP(INDEX(A1:A254,SEQUENCE(ROWS(A1:A254)/5,5)),,-1)
      If you're using Dynamic Array functions (and I assume you are since you are using the SEQUENCE function), a shorter version offered by another viewer is:
      =TAKE(WRAPROWS(Sales, 5),,4)
      Thanks for watching and contributing. It's always great to see alternate solutions. Cheers!

  • @DAXifiedSatish
    @DAXifiedSatish 5 ชั่วโมงที่ผ่านมา

    Though wrap rows is simple way to do this, i want to do this with my favorite Reduce Function
    =LET(TheMagicNumber,5,Data,A1:A254,
    REDUCE(TOROW(TAKE(Data,TheMagicNumber),1),
    SEQUENCE(ROWS(Data)/TheMagicNumber,1,TheMagicNumber,TheMagicNumber),
    LAMBDA(acc,curr,VSTACK(acc,TOROW(OFFSET(A1,curr,0,TheMagicNumber,1),1)))))

    • @bcti-bcti
      @bcti-bcti  5 ชั่วโมงที่ผ่านมา +1

      I always enjoy seeing how other people solve the same problem. Great job!

  • @Michael_Alaska
    @Michael_Alaska 3 วันที่ผ่านมา

    Overly complicated. No need for Power Query. Use formula =WRAPROWS(A:A,5) and viola!

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา

      Agreed! But for those who do not have access to Dynamic Array functions, Power Query is an option. Plus, this video also served as a way to demonstrate a variety of Power Query features for use in other situations.
      Sidenote: you would still need to filter out the resulting 5th column of zeroes, as well as the other 209K+ rows at the bottom of the output.
      Thanks for your ideas and time to watch. Cheers.

  • @boissierepascal5755
    @boissierepascal5755 3 วันที่ผ่านมา +2

    Hi ! Thank you for your work. A shorter way with M code.
    let
    Source = Excel.CurrentWorkbook(){[Name="Sales"]}[Content][Column1],
    TransfTable = Table.FromRows(List.Split(List.RemoveNulls(Source),4),{"Rank","Company","Category","Sales"}),
    Currency= Table.TransformColumnTypes(TransfTable,{{"Sales", Currency.Type}})
    in
    Currency

    • @bcti-bcti
      @bcti-bcti  3 วันที่ผ่านมา +1

      I LOVE IT!!!! That is fantastic! I have split your single step into separate steps so it's easier to understand for beginners. Thank you for a great solution. Different tactics are ALWAYS appreciated.
      let
      Source = Excel.CurrentWorkbook(){[Name = "Sales"]}[Content][Column1],
      #"Remove Nulls" = List.RemoveNulls(Source),
      #"Records to Lists" = List.Split(#"Remove Nulls", 4),
      #"Lists to Records" = Table.FromRows(
      #"Records to Lists",
      {"Rank", "Company", "Category", "Sales"}
      ),
      #"Set Data Types" = Table.TransformColumnTypes(
      #"Lists to Records",
      {{"Rank", Int64.Type}, {"Company", type text}, {"Category", type text}, {"Sales", Int64.Type}}
      )
      in
      #"Set Data Types"

    • @boissierepascal5755
      @boissierepascal5755 3 วันที่ผ่านมา

      @bcti-bcti 👏🏼👏🏼👏🏼