Power Query - COALESCE Operator (Shorten those formulas with a cool "mystery" operator)

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

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

  • @PatrickAngwin
    @PatrickAngwin 7 месяцев назад +20

    This is GREAT. I don't know how long your channel has been going; I have been watching Excel tutorials for many years and only recently come across you, but BCTI is fast becoming one of my favourite resources. Not only because your teaching style is so well paced, clear and easy to follow but, more importantly, because you often cover and introduce me to really useful, practical techniques I haven't seen elsewhere.
    Really good work, keep it up!

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад +6

      WOW!!! You've made my day. Such high praise. We just had our 1-year anniversary a few weeks ago, so we are still in our infancy. We hope to grow big and strong like the other channels. With your help, we'll get there. Thanks for watching.

    • @JM-mb6tf
      @JM-mb6tf 4 месяца назад

      All Excel licenses should come with a BCTI link

  • @RichardJones73
    @RichardJones73 7 месяцев назад +6

    The number of times I created another column for null values to become 0, is replaced value null with 0, when I didn't need to! Awesome tip

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад +1

      Yeah, I used to do the very same thing. Now my queries have fewer steps. I love being able to get to the objective with less work. Thanks for watching.

  • @jerrydellasala7643
    @jerrydellasala7643 7 месяцев назад +1

    After retiring in June 2020, I learned about Power Query, and have watched well over a thousand PQ videos. This is the first time I heard of the Coalesce operator! Nice!!

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад +1

      Yeah, it’s something I had never seen or heard until just a few months ago. I’m not sure why this is such an overlooked feature. Thanks for watching.

    • @GosCee
      @GosCee 5 месяцев назад

      I have watched numerous videos as well, and this is the first time I've heard of coalesce. Such a useful tip!

    • @bcti-bcti
      @bcti-bcti  5 месяцев назад

      @@GosCee I agree 100%. Thanks.

  • @Jill_Liu
    @Jill_Liu 7 месяцев назад +2

    Such an amazing tricks. I have been following your channel for a while i noticed that your tutorials are quite advanced explaining in a simple way. Great thanks for your sharing.

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад +1

      Thank you so much for taking the time to watch. I appreciate your thoughts. Very nice comment.

  • @baskis69
    @baskis69 7 месяцев назад +1

    I was completely unaware of this operator. Very useful. You always deal with issues that help us in our day to day! Thank you very much for sharing.

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад +1

      My pleasure. Thanks for watching.

  • @Adam_K_W
    @Adam_K_W 7 месяцев назад +6

    this is EPIC.

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад

      Thanks! I think so, too.

  • @MB-bd5gr
    @MB-bd5gr Месяц назад

    Î never heard of COALESCE operator before. I use to use (nested) if statements. Obviously COALESCE reduces the lines of code drastically. I will give it a try.
    I recently stumbled across this channel and I think the content and tutorials are really great and interesting. Please keep up the good work.

    • @bcti-bcti
      @bcti-bcti  Месяц назад

      We're so glad you have found the content useful. Thanks for your support.

  • @noneyabeezwax8865
    @noneyabeezwax8865 5 месяцев назад

    Please please please make more Power Query videos. Your teaching style is fantastic!

    • @bcti-bcti
      @bcti-bcti  5 месяцев назад

      @@noneyabeezwax8865 I’ll have a Power Query video out in a day or two. You’ll love it!!!! (Thanks for the compliment)

    • @bcti-bcti
      @bcti-bcti  5 месяцев назад

      Here you go, as requested:
      ruclips.net/video/UYHrLO1-iyE/видео.html

  • @thelastfry23
    @thelastfry23 7 месяцев назад +1

    Fantastic video! I didn't even know PQ behaved like that on additions, makes complete sense now why sometimes I run into issues. Will definitely put this to good use in the future! Keep up the excellent videos!

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад +1

      Glad to have helped!

  • @Undistinguished-ux9eg
    @Undistinguished-ux9eg 7 месяцев назад

    Amazing explanation of this little-known Power Query operator. I have already used it at work today, shortening my rather longer If formula.
    My use case: My imported bank account data has the debits and credits in separate columns (both being positive figures). I like them combined into 1 column. So instead of saying “If” debit column has a figure then give me that figure, “Else” give me the credit figure multiplied by minus 1, I just say: [Debit] ?? -[Credit].
    Aside of being shorter and more efficient - it just make me feel so much cooler and gives me some unexplainable satisfaction.
    Thank you sir, and adding to my other comment today, you’re now the GOAT of Power Query too:)

    • @ericliu79
      @ericliu79 4 месяца назад

      [Debit] ?? -[Credit] is great. Thank you!

  • @AJ-fd3yj
    @AJ-fd3yj 5 месяцев назад

    ... this is the third epiphany i had, thanks to you, how to shorten and improve my queries. thank you!

    • @bcti-bcti
      @bcti-bcti  5 месяцев назад

      FANTASTIC! So glad to hear it helped.

  • @leewism
    @leewism 7 месяцев назад +1

    Never saw this option before, love it. I think I will be using it a lot.

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад

      Same here. I find it quite useful. Thanks for watching.

  • @serdip
    @serdip 7 месяцев назад +1

    This was AMAZING!! Thank you so much for demonstrating this very powerful M Code technique, which greatly simplifies formulas in many common scenarios. I thought COALESCE() was just a function in T-SQL. :-)
    I wanted to try and make the summation of the Interantional and Domestic Sales table dynamic, meaning that if for some reason the source dataset was updated with another column, e.g. [Local Sales] (I couldn't think of a good name, LOL) or perhaps the source column names were changed. I noticed that the solution you provided, since it has hard coded column names, will not update to reflect values in the new [Local Sales] column or if the names of the columns changed.
    My solution was to convert each row of the table to a Record (actually each row *is* a record but in my thought process I had to "convert" it explicitly to a Record object), convert that Record to a List, select on the numeric values in the list and finally apply List.Sum() to the result. My solution is not very appealing visually, but it does handle the new [Local Sales] column automatically. It also works if any of the numeric columns in the source data gets renamed.
    So, at least in some limited cases, my solution might be helpful.
    Dynamic Summation - Column Names Not Hard Coded
    = Table.AddColumn(#"Removed Columns", "Sum Numeric Columns", each List.Sum(
    List.Select(
    Record.ToList(_),
    each Value.Is(_, Number.Type)
    )
    )
    )
    Again, this video (and all the rest of your content, quite frankly) is incredible! 😎
    Thank you kindly.

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад +3

      Thank you so much for taking the time to contribute to the channel. I think it's great that you are taking the idea to a whole other level. I'm sure other readers will appreciate your contribution. It's always a good idea to try to make things dynamic if possible.👍👍

  • @sharmarudra
    @sharmarudra 7 месяцев назад +1

    Worth in Gold. Thank you.

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад

      You are very welcome! Thanks for watching.

  • @suvojitghoshal1453
    @suvojitghoshal1453 7 месяцев назад +1

    Truly Truly Awesome content. Just Brilliant. !!

  • @brianxyz
    @brianxyz 2 месяца назад

    Thanks for the great explanation and examples, especially the last one.

    • @bcti-bcti
      @bcti-bcti  2 месяца назад

      @@brianxyz You’re quite welcome. We appreciate your support.

  • @MaureenPesch
    @MaureenPesch 7 месяцев назад

    This is great!!! I really struggle with blank date fields. Can’t wait to try this!

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад

      So glad to hear that may help. Thanks for watching.

  • @hichamhadj9640
    @hichamhadj9640 7 месяцев назад +1

    Your videos are amazing 😭

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад +1

      Thank you. That’s a very complementary thing to say. Thanks for watching.

  • @IvanCortinas_ES
    @IvanCortinas_ES 7 месяцев назад +1

    Excellent explanation. Thank you!!

  • @Bhavik_Khatri
    @Bhavik_Khatri 2 месяца назад

    Thank you for sharing these insightful tips.

    • @bcti-bcti
      @bcti-bcti  2 месяца назад

      So glad you found them useful. Thanks for the views.

  • @jazzista1967
    @jazzista1967 7 месяцев назад +1

    Very elegant trick with the ?? 0 if null technique. When i deal with scenarios like those, I would usually replace the null with zeros by using the find and replace user interface that way, PQ will perform the operation i need ( Lets say add or subtract). Just subscribe to your channel .Thanks

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад

      Thanks for your time and for subscribing!

  • @larmondoflairallen4705
    @larmondoflairallen4705 7 месяцев назад

    Gadzooks! I wish I had known about this capability years ago, but I am going to wear this out now.

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад

      AWESOME!!! Wear it out, my man.

  • @excel_along_the_way
    @excel_along_the_way 7 месяцев назад

    Thank you, much appreciated.
    You can add Cole Lesch now to your list of sales reps.

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад

      You are SOOOO right! That's a good one!

  • @Giridharan952
    @Giridharan952 7 месяцев назад

    wow .... great time saving ..sir,really useful for m code learners and also high practical use applicability

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад

      I couldn't agree more!

  • @jawadahmadehssan6251
    @jawadahmadehssan6251 4 месяца назад

    Great content and very practical. Thank you!

    • @bcti-bcti
      @bcti-bcti  4 месяца назад

      We appreciate you taking the time to watch and comment. 👍👍👍👍

  • @aliasghar09
    @aliasghar09 4 месяца назад

    This is something really great....Thank you GRAY !!!!

    • @bcti-bcti
      @bcti-bcti  4 месяца назад

      It IS rather cool!!! Thanks for watching.

  • @cuongtrieuduy4916
    @cuongtrieuduy4916 5 месяцев назад

    That’s awesome. Never see it before. Thank men

    • @bcti-bcti
      @bcti-bcti  5 месяцев назад

      @@cuongtrieuduy4916 glad you liked it. Thanks for watching

  • @eduardomunoz2764
    @eduardomunoz2764 2 месяца назад

    This is Great... Thank you very much for saharing.

    • @bcti-bcti
      @bcti-bcti  2 месяца назад

      You are very much welcome. Thank you for taking the time to watch and comment.

  • @djl8710
    @djl8710 7 месяцев назад +1

    Cool thanks!

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад

      You are most welcome. Thanks for watching.

  • @ChiMickE
    @ChiMickE 6 месяцев назад

    Didn't know that existed, very useful

    • @bcti-bcti
      @bcti-bcti  6 месяцев назад

      I couldn't agree more. Thanks for watching.

  • @subbu_ca
    @subbu_ca 6 месяцев назад

    Just awesome

  • @LilLinh
    @LilLinh 5 месяцев назад

    Thank you very much, your video were so interesting, smart and so unique.

    • @bcti-bcti
      @bcti-bcti  5 месяцев назад

      Thank YOU!!!!! 🥰

  • @RonDavidowicz
    @RonDavidowicz 7 месяцев назад +1

    I haven’t used this before, unfortunately I probably won’t know what I was doing if I looked at it later!😊

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад +1

      I suffer from that syndrome as well. If I don't use it often enough, I'll just end up confusing myself later. But I think this is cool enough to try working into my day-to-day operations. Thanks for watching.

    • @1qtaz
      @1qtaz 5 месяцев назад

      You can add a note for yourself (or others) in the step properties to remind yourself about the ??

    • @bcti-bcti
      @bcti-bcti  5 месяцев назад

      @@1qtaz great idea. Documentation is always a good thing.

  • @JM-mb6tf
    @JM-mb6tf 4 месяца назад

    How do I get the number formats to be included when I send the PQ data into Excel ?

    • @bcti-bcti
      @bcti-bcti  4 месяца назад

      Power Query has no responsibility to make the data look "pretty", That is the responsibility of Excel.

  • @txreal2
    @txreal2 7 месяцев назад

    Thanks 😊

  • @williamarthur4801
    @williamarthur4801 7 месяцев назад

    New to the channel, will subscribe,

    • @bcti-bcti
      @bcti-bcti  7 месяцев назад

      Thank you 👍🏻👍🏻👍🏻

  • @ManthaarJanyaro
    @ManthaarJanyaro 7 месяцев назад

    That's good 👍🏻😊

  • @ericliu79
    @ericliu79 4 месяца назад

    I can't believe it can be solved so easily. "?? 0"

    • @bcti-bcti
      @bcti-bcti  4 месяца назад

      Yes; it's crazy simple. Thanks for watching.