Convert Range of Values to a List - Power Query Challenge

Поделиться
HTML-код
  • Опубликовано: 12 дек 2024

Комментарии • 40

  • @bagnon
    @bagnon 2 года назад +2

    Doesn't get better than this when the solution is easy to understand and you learn something new that will be useful going forward.

  • @syedaneesdurez9880
    @syedaneesdurez9880 2 года назад +2

    Seen so far the best trick to convert values to a List.. Thank you so much. Appreciate

    • @AccessAnalytic
      @AccessAnalytic  2 года назад

      You're welcome. Thanks for letting me know

  • @Mister_Bates
    @Mister_Bates 2 года назад +3

    Always love these challenges: the taking part; but most of all, seeing simple, clean solutions. I'm now reviewing my powerquery implementations to see if I can simplify my list-handling steps!

    • @AccessAnalytic
      @AccessAnalytic  2 года назад

      It's great that everyone (including me) gets to learn a few new things each time

  • @hk_200k
    @hk_200k Год назад +1

    The 1st challenge I have ever watched here, which is just fab. Everyone showing off their secret recipe.😂

  • @Data_D_J
    @Data_D_J 2 года назад +2

    Very cool solution by Eric! Thanks for running this and publishing a video Wyn!🎉

  • @elinabueller135
    @elinabueller135 2 года назад +1

    makes life so much easier....thanks y'all!

  • @IssueBoyStefan
    @IssueBoyStefan 2 года назад +2

    It's good to know that there is such a function Expression.evaluate().
    I guess I was a bit lazy submitting {start..end} solution. :D
    Many thanks for the nice challenge and video Wyn!

  • @abdulsaidmkamara7305
    @abdulsaidmkamara7305 2 года назад +1

    Beautiful Solution There and great unique technique !

  • @Softwaretrain
    @Softwaretrain 2 года назад +1

    My suggestion is custom column as below:
    [splt=List.Transform(Text.Split([Ticket Range],"-"),Number.From),
    lst={splt{0}..splt{1}}
    ][lst]

  • @vijaykrishnan4151
    @vijaykrishnan4151 Год назад

    Thank you , lot of simple ways to do it.. :). I did the most toughest way ever possible to solve this problem :D using List.Generate.

    • @AccessAnalytic
      @AccessAnalytic  Год назад

      Lots of ways to achieve the goal in Power Query 😀

  • @wayneedmondson1065
    @wayneedmondson1065 2 года назад +1

    Awesome! Thanks Wyn!!

  • @Luciano_mp
    @Luciano_mp 2 года назад +1

    Cool solutions! Good! Thank you...

  • @ezelkarlkl1284
    @ezelkarlkl1284 2 года назад +1

    Thank you so much ! perfect solutions...

  • @mirrrvelll5164
    @mirrrvelll5164 2 года назад +1

    All of these tricks were useful =)

  • @brianxyz
    @brianxyz 2 года назад +1

    Blown away!

  • @rrrraaaacccc80
    @rrrraaaacccc80 Год назад

    👍💯

  • @apostolos55goulandris97
    @apostolos55goulandris97 2 года назад

    Hi, indeed a great solution but in my humble opinion it is not the best (nor the fastest to code or execute). A simple demo with 340 rows already produces significant time differences.
    What I propose (I include my code -Apostolos):
    let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Added Custom" = Table.AddColumn( Source, "list_of_Nos", each List.Numbers( Number.FromText( Text.BeforeDelimiter([Ticket Range], "-") ), [Number of Ticket]) ),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Number of Ticket", "Ticket Range"}),
    #"Expanded list_of_Nos" = Table.ExpandListColumn(#"Removed Columns", "list_of_Nos")
    in
    #"Expanded list_of_Nos"
    notes: use the List.Numbers with data from the table, no added columns, then remove unwanted columns 1st and then Expand...
    I Include the code for Eric's solution:
    let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Added Custom1" = Table.AddColumn(Source, "Custom", each Expression.Evaluate( "{"& Replacer.ReplaceText( [Ticket Range],"-","..")&"}" )),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Custom1",{"Name", "Custom"}),
    #"Expanded Custom" = Table.ExpandListColumn(#"Removed Other Columns", "Custom")
    in
    #"Expanded Custom"
    notes: again with removing 1st, then expanding
    Ok, I will close by just reminding that Evaluate existed/exists in VBA as well but is like a "pandora box" if not used with caution...
    Thanks anyway for a great presentation and all the tips :D

  • @GeertDelmulle
    @GeertDelmulle 2 года назад

    I'm a little sad, here: I'm subscribed to your channel and rang the bell and all, but I get to see these video's so darn late.
    I saw reference to this challenge on the Oz DuSoleil channel as a trigger...
    Anyway, here's my single cell solution:
    =LET(labels,F6:F8,data,G6:G8,
    splitdata,TEXTSPLIT(TEXTJOIN(";",,data),"-",";"),
    LB,TAKE(splitdata,,1), UB,TAKE(splitdata,,-1),
    RangeLabel,TEXTSPLIT(TEXTJOIN(",",,MAP(labels,LB,UB,LAMBDA(L,a,b,TEXTJOIN(",",,IF(SEQUENCE(,b-a+1,1,1),L,""))))),,","),
    RangeData,TEXTSPLIT(TEXTJOIN(",",,MAP(LB,UB,LAMBDA(a,b,TEXTJOIN(",",,SEQUENCE(,b-a+1,a))))),,","),
    HSTACK(RangeLabel,RangeData))
    Hope you like it.
    (Now I'll watch your video)

    • @GeertDelmulle
      @GeertDelmulle 2 года назад +1

      PS: here's my first update already. I like this better: it's more of a complete experience: 😉
      =LET(FullTable,fRAW[#All],headers,TAKE(FullTable,1),
      labels,DROP(TAKE(FullTable,,1),1),data,DROP(TAKE(FullTable,,-1),1),
      LB,TEXTBEFORE(data,"-"), UB,TEXTAFTER(data,"-"),
      RangeLabel,TEXTSPLIT(TEXTJOIN(",",,MAP(labels,LB,UB,LAMBDA(L,a,b,TEXTJOIN(",",,IF(SEQUENCE(,b-a+1,1,1),L,""))))),,","),
      RangeData,TEXTSPLIT(TEXTJOIN(",",,MAP(LB,UB,LAMBDA(a,b,TEXTJOIN(",",,SEQUENCE(,b-a+1,a))))),,",")+0,
      VSTACK(headers,HSTACK(RangeLabel,RangeData)))

    • @GeertDelmulle
      @GeertDelmulle 2 года назад

      PS: my input table does not have the "Number of tickets" column.

    • @AccessAnalytic
      @AccessAnalytic  2 года назад +1

      @@GeertDelmulle That's one Crazy Formula! I've not played with MAP in the real world yet. I'll have to check it out.

  • @williamarthur4801
    @williamarthur4801 2 года назад +1

    Oh wow, well that's my homework for tomorrow, expression.evalueate, I don't think I've ever seen it used before.