Optimizing conditions involving blank values in DAX

Поділитися
Вставка
  • Опубліковано 5 лип 2021
  • Learn how blank values in a DAX conditional expression can affect its query plan and how to apply possible optimizations to improve performance in these cases.
    Article and download: sql.bi/483918?aff=yt
    How to learn DAX: www.sqlbi.com/guides/dax/?aff=yt
    The definitive guide to DAX: www.sqlbi.com/books/the-defin...
  • Наука та технологія

КОМЕНТАРІ • 24

  • @gustavobarbosa906
    @gustavobarbosa906 3 роки тому +2

    Such a small detail with such large impact! Thank you!

  • @dancastillo8370
    @dancastillo8370 3 роки тому +3

    This was so helpful, thank you DAX master

  • @vinayakvhegde
    @vinayakvhegde Рік тому +1

    😊 very useful information. Thank you for sharing this

  • @2chandra
    @2chandra 3 роки тому +1

    I didn't know that Blank() and 0 are same in DAX. Thanks for valuable information.

    • @SQLBI
      @SQLBI  3 роки тому +1

      You can see more here: www.sqlbi.com/articles/blank-handling-in-dax/

  • @kalinduSekara
    @kalinduSekara 3 роки тому +1

    Thanks Alberto

  • @pbihari0214
    @pbihari0214 3 роки тому +1

    Thank you

  • @Anthony_Lecoq
    @Anthony_Lecoq 3 роки тому +1

    So great :)

  • @abhinavkhanduja1856
    @abhinavkhanduja1856 3 роки тому +1

    Hi Alberto, At approximately 6:40 you mention that the engine is doing auto-exists for the columns of the three different tables, but as far as I understand, auto-exists would kick in only if the columns are from the same table. In this instance i.e. when just using SUM(Sales[Quantity]), isn't it simply the case that SUMMARIZECOLUMNS is removing blank values from the result?

    • @SQLBI
      @SQLBI  3 роки тому +5

      Auto-exists is a term that we somewhat abuse of :) There is an auto-exist at the filtering level, executed by SUMMARIZECOLUMNS when multiple columns from the same table are being filtered, and another sort-of auto-exists that is an optimization in the scanning executed at the lower level, by any function. If the engine knows, from the semantics of the measure, that a non-existing combination results in a blank, then it skips that specific evaluation.
      We do not have a name for this second auto-exists, therefore we call it the same way. Indeed, they are different behaviors.

    • @jessamhan
      @jessamhan 3 роки тому

      @@SQLBI Auto-blank-elimination :)

  • @beginho2454
    @beginho2454 3 роки тому +1

    Thanks Alberto. It is so interesting. Seems Variable version costs less time which is 68ms.
    Why not choose that?

    • @SQLBI
      @SQLBI  3 роки тому +2

      The variable version somewhat forces eager evaluation, whereas the one without leaves a bit more freedom to the optimizer, for possible future improvements. Anyway, it is also a matter of personal taste :)

    • @beginho2454
      @beginho2454 3 роки тому

      @@SQLBI Thanks a lot sqlbi team. always sharing!

  • @diegomex85
    @diegomex85 3 роки тому +1

    oO amazing =)

  • @michaelmays9415
    @michaelmays9415 3 роки тому

    Why do you prefer the code that doesn’t use variables? If it’s because variables force eager evaluation, do you have an article of the risks?

    • @SQLBI
      @SQLBI  3 роки тому +1

      The variable version somewhat forces eager evaluation, whereas the one without leaves a bit more freedom to the optimizer, for possible future improvements. Anyway, it is also a matter of personal taste :)

  • @sbdyelse
    @sbdyelse 3 роки тому +1

    I thought auto exist was only working with the column of the fact table but I was probably not understand it well yet. I Must read again about it then … hmm 🤔

    • @SQLBI
      @SQLBI  3 роки тому +1

      Please see the answer to Abhinav Khanduja

  • @sane7263
    @sane7263 2 роки тому

    One Question: I am a little confused, due to Auto-Exist
    will it only return the combinations which Exist in the Original data, or
    will it return all the combinations but do the computation of the specified expression only on the combination which Exists in the Original data?

    • @SQLBI
      @SQLBI  2 роки тому

      Only those that exists in the original data are considering in any following computation.

    • @sane7263
      @sane7263 2 роки тому +1

      @@SQLBI Got It, Thank You👍

  • @sbdyelse
    @sbdyelse 3 роки тому +1

    I thought auto exist was only working with Column from the same table … I realize I was probably wrong. Hmm …🤔

    • @SQLBI
      @SQLBI  3 роки тому +1

      Please see the answer to Abhinav Khanduja