Introducing window functions in DAX

Поделиться
HTML-код
  • Опубликовано: 7 окт 2024
  • This video introduces the syntax and functionalities of the new DAX window functions: INDEX, OFFSET, and WINDOW.
    Article and download: sql.bi/784024?...
    How to learn DAX: www.sqlbi.com/...
    The definitive guide to DAX: www.sqlbi.com/...

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

  • @mohamedmossad9458
    @mohamedmossad9458 Год назад +3

    Thank you Alberto. Great work as usual from SQLBI.
    The best syntax for window functions is best described by Jeffrey Wang.
    Function ( , , , , , )

  • @tamerjuma
    @tamerjuma Год назад +3

    Super ❤
    I had the decision not to even try window functions until I see your video about them. I cannot wait to see more specially the performances related video. I will start using them today itself. Thank you Alberto for everything.

  • @jorstube
    @jorstube Год назад +3

    Muchas Gracias Alberto, es maravilloso todo lo que va mejorando power Bi y sus funciones , con tantas actualizaciones simplemente tocara solo dedicarse a ello , excelente explicacion como siempre!!!

  • @engvictorfarias
    @engvictorfarias 8 месяцев назад +1

    Amazing, Alberto! 🤗😍
    Wonderful as always. I have always learned a lot from you. I use Dax's book as my holy bible.
    Hugs from Brazil, Victor.

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

    Thank you very much, @SQLBI!
    Watching Alberto , materializing his ideas is always a great pleasure to me.
    I have a little question / consideration about the syntax used in OFFSET() demo -- [20:55] -- using of ALL() function to get Dates.
    I mean that ALL() returns additional blank row, so it will add a blank row in the head of the 'DatesAndSales' table, that will yeild one false positive to our results set.

  • @louism.4980
    @louism.4980 4 месяца назад +1

    Phenomenal intro and demonstration, sir!

  • @timolff9239
    @timolff9239 Год назад +3

    great video as always, thanks. The INDEX function would have been incredibly useful when i once had to make a cash flow analysis based on a table from an accounting ERP system that would create 13 records with cash balances each year - one on the last day of each month what the cash balance is but one additional record on the first day of the year each year

  • @danthompson8309
    @danthompson8309 Год назад +2

    Thank you very much for the clear explanation

  • @lucasmonta1
    @lucasmonta1 3 месяца назад +1

    I was going to ask if this would make the old GuyInAQube question/collab video easier, and I'm happy to see that the offset example is exactly that case scenario

  • @gFowmy
    @gFowmy 10 месяцев назад +1

    Please update us if the apply semantics white papers are completed for us to read. Thanks for this fantastic video.

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

    All right. Need to use these new functions.

  • @Justbrowsingsoflo
    @Justbrowsingsoflo 11 месяцев назад +1

    Great video, thank you. Your content has had a profound impact on my DAX journey.
    I was attempting to pass a filtered table (topn) into the relation parameter of INDEX function but I kept getting an error. "Relation parameter may contain duplicate rows. This is not allowed."
    The table didn't have duplicates however.
    I know I am missing something.

  • @dc-sg8ot
    @dc-sg8ot Год назад +1

    Sqlbi, please do your customer retention piece using win functions! Keen to see if there are performance improvements. Love your work 👏

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

      Apparently, it doesn't provide a performance benefits if you use the more optimized code we used on daxpatterns.com

    • @dc-sg8ot
      @dc-sg8ot Год назад

      @@SQLBI I am using your dynamic approach from your dax patterns course as I segment on brand instead of category. Doing the snapshot approach with over 500 brands isn't suitable. I was hoping window functions may have some gains, that's a shame.

  • @samirvaghasiya9918
    @samirvaghasiya9918 9 месяцев назад +1

    Very useful video. Thank you very much
    😍

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

    It is possible to use WINDOW function and sort by calculated column [@Sales]. The from_type/to_type parameters in that case must be specified as 'ABS'.

  • @josephansah
    @josephansah Год назад +2

    Awesome. No half-baked, rushed demos just to get something out because it got released 10 seconds ago 👏🙂
    Can I ask why you alternate between using ADDCOLUMNS+SUMMARIZE in some demos and SUMMARIZECOLUMNS in others?
    I read on a forum that SUMMARIZECOLUMNS should not be used in measures since it does not enable context transition but you seem to use it in your demos within DAX studio.
    Would it not cause less confusion for students if you stuck with ADDCOLUMNS + SUMMARIZE? Thank you.

    • @SQLBI
      @SQLBI  Год назад +2

      We use SUMMARIZECOLUMNS to show the result of a query (Power BI uses SUMMARIZECOLUMNS for that) and we use ADDCOLUMNS + SUMMARIZE in code that can be embedded in a measure.
      Thanks for the comment, we'll try to make this clearer in the future!

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

    I always do axchange curancy. 1.8 milion sometimes 2 excel books rows in my excel . this technic is very usefull.
    Great video, I tried it in my own table, but i get blanck rows. Checked all formats and so on....

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

    Thanks for the amazing fresh vedios for window functions!!! Can't wait for it to get generally available.
    Also wondering when Bravo's Time Intelligence Measures are going to update with the new window functions 🤭

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

      They don't provide performance improvements over other techniques. The code could be shorter in a few cases, but for Bravo it doesn't matter as the code is generated by the template. And it's too early to use these new functions in production.

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

      @@SQLBI that’s reassuring! Thanks for the explanation ;)
      Bravo is amazing by the way. I’m using it on my current work project, and they are working PERFECTLY! I’m very surprised how fast and easy it is. My teammates and manager are also constantly getting surprised by the model I build with Bravo 😝

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

    Excellent video as alwasy, very informative and insightful. I was wondering though, in the last example for WINDOW, why do you add the second ORDERBY column? Shouldn't YearMonthNumber be enough to sort the table, what additional need is there to add YearMonth to the sorting? Thanks!

  • @bradj229
    @bradj229 9 месяцев назад +1

    Great video. Thank you :)

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

    Each one of your videos is a pure goldmine of information. I wanted to check if this can be implemented in the following scenarios: If you want to calculate the maximum value of a measure for the relative 12 months, can the WINDOW function be utilized? I tried it but I just get the MAX of each specific year-month combination. but I need the single MAX of those 12 months to appear in the full selection. So something like:
    P3-2021 = 15
    P4-2021 = 8
    P5-2021 = 10
    P6-2021 = 12
    ... P2 -2022 =7
    If within those 12 relative months, the highest value is 15 then for all those periods to return that dynamic MAX value, so the end result should be:
    P3-2021 = 15
    P4-2021 = 15
    P5-2021 = 15
    P6-2021 = 15
    ... P2 -2022 = 15
    Can this be achieved with WINDOW or would you recommend a different function? I tried with calculatetable and previous date calendar but for some reason I get only the last period value as the MAX :( in this example that would be:
    P3-2021 = 7
    P4-2021 = 7
    P5-2021 = 7
    P6-2021 = 7
    ... P2 -2022 = 7

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

      Try to formulate the question in the articles' comments and by using the model of the sample file - it's easier to get an answer that way!

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

    In the rolling average graph during window function, I can see the rolling average value is extending to 5 months in future. How can I prevent that from hapenning?

  • @OlsoNounas
    @OlsoNounas 10 месяцев назад

    Is my understanding correct that a limitation of window functions, particularly from a visualisation standpoint, is the necessity of including a specific column (e.g., ReportingDate) in the visual in order to obtain a value for a previous date? I aim to avoid including that column. Are there any potential workarounds for this?
    To illustrate, let's consider a straightforward report featuring a table visual with columns sourced from a fact table: ProjectID, ActualDate, and PreviousActualDate (a measure).
    The report includes a dropdown filter (ReportingDate) derived from a dimension reporting date table, establishing a one-to-many relationship with the fact table, filtered to a single date.
    It seems challenging to utilise a window function to retrieve the PreviousActualDate in the table visual without having to include the reporting date column. I have attempted to do so, but it consistently displays as blank unless the reporting date is included in the visual. Are there any strategies or alternatives to address this issue? I've reverted to using a window function in a calculated column in the fact table for now.

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

    Thank you ❤

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

    Hi, can you tell me what kind of camera and lens you are using for your recording? Looks really good. thanks

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

      It's all here: www.sqlbi.com/blog/alberto/2021/02/14/on-my-recording-gear/

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

      @@SQLBI thank you

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

    In pure SQL window(analytics) function can be used on table and on results (agregate). How can be achived in DAX? Make windowed calculation on result of group of calculations.

  • @ZappPSR
    @ZappPSR Год назад +8

    For a moment I thought FUILKTER() was a version of FILTER() in German. 😀

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

    hello,
    can windowing function on another type from date ?like i want to winfow sales by products

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

    Whilst it's not always a strict improvement on the existing methods, would you say, if one is the in the process of "Mastering DAX" to opt towards these rather than the incumbent functions? In a vacuum, for the usual day-to-day use cases.

    • @SQLBI
      @SQLBI  Год назад +4

      Don't be in a hurry to use a new function unless you have a specific use case where it's a clear advantage! Nobody has enough experience today to say whether in the long term they are better or not than similar solutions.

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

    🔥🔥🔥

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

    1:59 INDEX
    18:03 OFFSET
    29:48 WINDOW

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

    Hello! Will you Update Mastering Dax Course with this all new features??

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

      Yes, but only once they settle down - they are still in preview. We are working on a new version of Optimizing DAX, we'll still be busy for the next few months. A new edition of Mastering DAX will be published much later, not in 2023.

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

    Why does one need 40 min videos for something that should be so simple, yet powerful such as Window Functions? This is all you need to know about the issues with DAX.
    Way more powerful: produce a series of videos that describes WHY one would need to invest time in DAX, as apposed just writing code in SQL.

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

      Because in DAX you write a measure that works in a semantic model (potentially in multiple reports), whereas in SQL you write a query for a specific report. They have different purposes.

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

    BTW This Thumbnail so cute

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

    Do you have any courses on Udemy?

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

    How can we use the Relation arguments in all these functions?

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

      It's explained in the article and in the video!

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

    Hello Dear, Can you share the data you used for this example? pls

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

      You can find the example in the related article (the download was missing previously but now it's there).

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

    🎉

  • @Truth-N-Lies
    @Truth-N-Lies Год назад

    Sir, I'm Unable to calculate moving/running average using
    Average Cost moving =
    AVERAGEX(
    WINDOW(
    1,ABS,
    0,REL,
    SUMMARIZE(ALLSELECTED('Custom Calendar Table'), 'Custom Calendar Table'[FY], 'Custom Calendar Table'[Month Name]),
    ORDERBY('Custom Calendar Table'[FY], ASC, 'Custom Calendar Table'[Month Name], ASC)),
    [Actual Cost]
    )
    Results is
    Average Cost moving Actual Cost Month Name FY
    220599.2747 220599.2747 Dec FY 22-23
    219440.6214 219440.6214 Jan FY 22-23
    216470.4219 216470.4219 Feb FY 22-23

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

    You are looking more handsome with your beards

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

    Do you have any courses on Udemy?