Working below a DAX formula’s granularity

แชร์
ฝัง

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

  • @franciscoclaudio4818
    @franciscoclaudio4818 3 ปีที่แล้ว +1

    With every video or article I see from SQLBI I feel illiterate on DAX.
    Excellent class!

  • @gulhermepereira249
    @gulhermepereira249 3 ปีที่แล้ว +8

    This channel is one of the best DAX reference out there, and it's free!
    Thank you, Alberto

  • @laviedandre
    @laviedandre 3 ปีที่แล้ว +4

    Brilliant! I've usually struggled with controlling the result shown below the intended granularity. This is a great step-by-step tutorial of how to manage the result above and below!

  • @JonathanCHANAL
    @JonathanCHANAL 3 ปีที่แล้ว +3

    This is just perfect, thank you for sharing

  • @sbn4862
    @sbn4862 2 ปีที่แล้ว +1

    super

  • @mnowako
    @mnowako 3 ปีที่แล้ว +2

    Excellent lesson. Thank you, professor Alberto.

  • @juancarlosvillegascuevas2597
    @juancarlosvillegascuevas2597 ปีที่แล้ว +1

    You're such a master with DAX, I watched the video and I realized that I need to understand better the fundamentals in order to understand the code you share with us.
    Great TH-cam channel!!

  • @hannesw.8297
    @hannesw.8297 3 ปีที่แล้ว +1

    Hi Alberto!
    The last solution seems very complicated to me, I just would to this:
    High Months (3) = IF(NOT( ISFILTERED('Date'[Date])), [High Months (2)])
    Seems to have the same outcome, are there any issues I oversee?

    • @porraloka31
      @porraloka31 2 ปีที่แล้ว +1

      If the user wants to see at the week granularity you'll have problems with your code, as weeks are below the month granularity but above days.

  • @sue_bayes
    @sue_bayes 3 ปีที่แล้ว +1

    Really useful to see the different approaches based on the customer need. The explanation of High Months 3 showing how to return the result of each variable step by step was helpful in understanding how you built the measure and why you had to use remove filters instead of AllExcept. Thank you.

  • @goldwhispers
    @goldwhispers 3 ปีที่แล้ว +1

    such an important video! grazie!

  • @javedkhan-tz6fn
    @javedkhan-tz6fn 3 ปีที่แล้ว +1

    Superb....this is the root cause

  • @yacobberk3931
    @yacobberk3931 3 ปีที่แล้ว +1

    Hi,
    Based on your lesson , I can propose shorter solution for "the blank option whenever the report goes below the supported granularity"
    High Months (4) =
    CALCULATE (
    SUMX( VALUES ( 'Date'[Calendar Year Month]) ,
    var daysNo= count('Date'[Calendar Year Month])
    Return
    if([Sales Amount]>30000 && daysNo>1 ,1)),
    all('Date'[Calendar Year Month]), VALUES ( 'Date'[Calendar Year Month] )
    )

    • @SQLBI
      @SQLBI  3 ปีที่แล้ว

      It's an option, too - sometimes users are surprised by the UI behavior doing that (it seems something doesn't work).

    • @yacobberk3931
      @yacobberk3931 3 ปีที่แล้ว

      ​@@SQLBI Hi again, my option High Months (4) is giving the same result as your High Months (3) expression , please have a look
      drive.google.com/file/d/1QurWVEGUUtujdpdUS0lbuB70OeTksALW/view

  • @ajit555db
    @ajit555db 3 ปีที่แล้ว +1

    In the article too, the link to the TH-cam video can be provided so that someone reading the article directly would not miss this video.

    • @SQLBI
      @SQLBI  3 ปีที่แล้ว

      Thanks for reporting! We just added the video to the article, it seems we forgot to include that link!

  • @sbn4862
    @sbn4862 2 ปีที่แล้ว +1

    I've seen this video 6 times with today's, evry time it gives me hope to learn DAX.
    We need a book with different training tasks for evry concept and function FROM ZERO TO MAX.
    I'll by it imidently. Thank you

    • @SQLBI
      @SQLBI  2 ปีที่แล้ว

      You probably want this book :)
      www.sqlbi.com/books/the-definitive-guide-to-dax-2nd-edition/

    • @sbn4862
      @sbn4862 2 ปีที่แล้ว

      @@SQLBI Yes Thank you

  • @pawewrona9749
    @pawewrona9749 3 ปีที่แล้ว +1

    Another amazing DAX video

  • @bhaveshpatelaus
    @bhaveshpatelaus 3 ปีที่แล้ว +4

    This is the ultimate gold of how DAX really works and enabling data models for large number of users to self serve without explaining each of them how that measure really works and why it is displaying this results. Thank you Alberto and a must watch for all Tabular model designers.

  • @danielsiffredi8403
    @danielsiffredi8403 3 ปีที่แล้ว +1

    Alberto, you are a maestro!

  • @l3ol3lca
    @l3ol3lca 3 ปีที่แล้ว

    In third measure instead of using variables, we can use simple condition: if isfiltered( 'Date'[Date]) then blank, else calculate(.....). Thank you!

  • @ajit555db
    @ajit555db 3 ปีที่แล้ว

    To force the measures at correct granularity, I am thinking about the following pattern:
    1. Create a set of "Granularity level" measures to identify the granularity e.g. "Calendar Level" which provides if the calculation is happening at Year, Month or Day level. (reference: www.daxpatterns.com/hierarchies/)
    2. In the measure development, determine the granularity using above "granularity level" measures and then change the context accordingly and calculate the expression.
    This might help in standardization of measure development at correct granularity.

  • @anshumansingh3106
    @anshumansingh3106 3 ปีที่แล้ว +1

    excellent explanation....

  • @ajit555db
    @ajit555db 3 ปีที่แล้ว

    I feel in the DAX book, we are providing lots of concepts and details about functions/modeling first and then explain measures. It is really overwhelming for the first time reader.

    Without understanding measures first in a simple way, it is very difficult to understand how these various concepts (evaluation context, transition, lineage, relationships, iterators, granularity etc) work in sync and we never understand the dynamics of concepts working together. Due to this, when we reach to write advanced measures, we can't since we did not understand the concepts in the first place.
    I think the book should start upfront with simple measure without any tables and slowly develop measures in increasing complexity using advanced concepts (evaluation context, relationships etc). This would force students to understand the concepts with respect to the measure and they can understand the dynamics of interrelated concepts much better.
    I am reading the DAX book for the fourth time, and this time, reading each chapter again relating with measure development and slowly the brain has started inter-relating the concepts wrt measures.

  • @josemadrid4343
    @josemadrid4343 3 ปีที่แล้ว +1

    Thank you!

  • @FitofnietOfficial
    @FitofnietOfficial 2 ปีที่แล้ว

    Hi Alberto,
    When I write the "High Months (Wrong)" measure as follows, then I also get the correct values. I'm curious why this formula works when you put the filter arguments in a outer calculate:
    High Months (Wrong) =
    CALCULATE (
    SUMX (
    VALUES ( 'Date'[Calendar Year Month] ),
    IF (
    [Sales Amount] > 30000, 1 ) ),
    ALL ( 'Date' ),
    VALUES ( 'Date'[Calendar Year Month] )
    )
    Thanks,

    • @supersayan9888
      @supersayan9888 ปีที่แล้ว

      That's because there is no context transition thats taken place when you directly write the expression in the row context.

  • @Darknesslc3
    @Darknesslc3 3 ปีที่แล้ว

    is it correct to say that context transition is effectively does not happen when we input something in the filter argument of CALCULATE? Or it just replace part of the filter context generated by context transition? Based on my understanding the context transition only happen on the in CALCULATE , but the filter argument will modify the filter context generated by context transition in the end

    • @SQLBI
      @SQLBI  3 ปีที่แล้ว

      Yes, context transition only affects the expression. Check out evaluation order here: dax.guide/calculate/

  • @ranganathkumar9188
    @ranganathkumar9188 3 ปีที่แล้ว

    very help full video
    i would like to know can we include Product / Customer slicing along with Calendar

    • @SQLBI
      @SQLBI  3 ปีที่แล้ว

      Yes, of course!

  • @MedinaZyzz
    @MedinaZyzz 3 ปีที่แล้ว

    I'm currently reading the Definitive Guide to DAX for the first time, I'm pretty much a newbie in the DAX world so I kind of get the concepts to an extent and understand the formulas but can't think of the formulas by myself... is it normal? What are your suggestions? Thanks in advance Alberto!

    • @SQLBI
      @SQLBI  3 ปีที่แล้ว +1

      Just practice! The evaluation context is a unique concept that does not have similarities with other languages. Start with simple reports and task, it usually takes months before you start "thinking" in DAX... don't give up!

    • @MedinaZyzz
      @MedinaZyzz 3 ปีที่แล้ว +2

      @@SQLBI Thanks fot the advice! it means a lot to me.

  • @Bharath_PBI
    @Bharath_PBI 3 ปีที่แล้ว

    Context transition, learnt from Definitive Guide to DAX first edition. Enjoying DAX with you. 👍
    Can we use isinscope() to get the right level in hierarchy to get rid of 1 at day level ?

    • @SQLBI
      @SQLBI  3 ปีที่แล้ว

      Outside of the SUMX, yes.

    • @Bharath_PBI
      @Bharath_PBI 3 ปีที่แล้ว

      @@SQLBI Yes, thank you 👍