CALCULATE in DAX #10: Using TREATAS

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ม.ค. 2025

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

  • @jorparts
    @jorparts 4 ปีที่แล้ว +2

    Hands down ...
    When I watch these videos it is like programming poetry. What level!!!!
    Thanks

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

    This whole series is well worth periodic re-watching.

  • @amadiftikhar3227
    @amadiftikhar3227 4 ปีที่แล้ว +11

    TREATAS function always looked strange to me and was never able to understand it until this Video. Thank you Alberto and SQLBI :)

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

      I agree. Something about it is intimidating. This video really demystifies what's going on.

    • @NL-tq1yr
      @NL-tq1yr 3 ปีที่แล้ว

      @@rcb3921 yeah, it's intimidating because iirc every measure which is based on a relationship in dax is basically translated into a query that has treatas in it, dax doesn't understand relationships it's just translates every measure you write into a treatas statement.

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

    These videos are incredibly useful! Thanks for sharing your knowledge :)

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

    Thank you Alberto, it’s great to know TREATAS can be used for this, and supports multiple columns. Especially helpful when we don’t have a relationship between the tables established. Thanks!

    • @zxccxz164
      @zxccxz164 11 หลายเดือนก่อน

      but why don't you just create the needed relationship???

  • @inkuban
    @inkuban 4 ปีที่แล้ว

    The best explanation in my opinion for users with intermediate knowledge.

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

    Thanks, Alberto! Hugs from Brazil.

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

    You guys always blows my mind!

  • @danielsiffredi8403
    @danielsiffredi8403 4 ปีที่แล้ว

    Never used treatas before, but I can see now how useful this is thanks to your great explanation. Thanks again!

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

    Yes, it's very common in queries returned by performance analyser, quick measures.. etc., But still not so common among DAX users, not many people use it at least from what I see. The SQLBI blog about treatas is a wonderful article that describes it's efficiency. Appreciate it. Thank you.👍

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

    Great! i use your tips to sovle the self-defined date calendar calcuation.
    Really Amazing!

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

    Beautiful function!

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

    Wooow really I'm feeling great to subscribe the channel and learning DAX in easy understand manner.
    Thanks for your effort to share your knowledge 📚 to everyone.

  • @germanhenriquez24
    @germanhenriquez24 4 ปีที่แล้ว

    Wow! Thanks Alberto ! With this I will be able to solve a scenario.

  • @莫迪-z4w
    @莫迪-z4w 4 ปีที่แล้ว +1

    Have seen Treatas in DAX Studio, was not clear about the semantics behind. Thanks SQLBI ! DAX Master.

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

    you are sharing awesome knowledge

  • @solidoffortitude
    @solidoffortitude 4 ปีที่แล้ว

    Thank you. I think the first example is good to demonstrate the general purpose of the function, but it is the second one that highlights the most appropriate use case - it is "IN" functionality but for multiple columns at the same time. Very valuable lesson!

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

      In reality IN is a simple example, but the IN syntax is good especially for one or just a few values. TREATAS is handy in more complex situations or when you manage larger lists of values to filter.

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

    Really Helpful...Thank you!

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

    Amazing ! Really Helpful...Thanks Alberto

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

    Thanks in a million. Great content. Awesome. Grade: A++💥

  • @scramiro1
    @scramiro1 4 ปีที่แล้ว

    Thanks so much! Much clearer I was stuck with this function in your book, so this helped a lot. Enjoy DAX ;-)

  • @marlonmunozguevara7778
    @marlonmunozguevara7778 4 ปีที่แล้ว

    Waoo Amazing Explanation. Thanks Alberto , I really enjoy Dax!

  • @yeraldo05
    @yeraldo05 4 ปีที่แล้ว

    Amazing!!!! Mind-blowing as always!!!

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

    Wooowww it's Amazing... Thank you soomuch...

  • @wmfexcel
    @wmfexcel 4 ปีที่แล้ว

    Amazing! Thanks for this great video that explains the TREATAS so well.

  • @2404Pepe
    @2404Pepe 4 ปีที่แล้ว

    So grateful !!!! thanks!!!!! molte grazie!!!! grazie infinitamente!!!! GRACIAS !!!!! great work

  • @zxccxz164
    @zxccxz164 11 หลายเดือนก่อน +1

    i don't get it. Why would you use treat as when then relationship works fine? And if you don't have a relationship, why not create one. I am sure this is very powerful, but this example isn't helping me understand

  • @joaquimcosta952
    @joaquimcosta952 4 ปีที่แล้ว

    Amazing explanation like always!

  • @This.is.thomasco
    @This.is.thomasco 4 ปีที่แล้ว

    Is there a way to use TREATAS with the selected value in the slicer to filter a table?

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

      The selection in a slicer can be read using VALUES, but I'm not sure about what you want to achieve with TREATAS.

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

    Crazy, how you make the TREATAS so easy to understand?

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

    Can the database you use for your video’s be downloaded somewhere? Its a Nice dataset for practise. Nice video

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

      It is part of the companion content of our book - the book is on sale, the companion content can be downloaded here:
      www.sqlbi.com/books/the-definitive-guide-to-dax-2nd-edition/

  • @Kmsbi
    @Kmsbi 4 ปีที่แล้ว

    wonderful information like always

  • @distrilanalytics
    @distrilanalytics 4 ปีที่แล้ว

    Wonderful video.

  • @SandipanSarkar-c8v
    @SandipanSarkar-c8v 5 หลายเดือนก่อน

    Finished watching

  • @abeworldforever
    @abeworldforever 4 ปีที่แล้ว

    Very Interesting!
    Is it more performant than using the "in" statement you used earlier?

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

      Not much for few elements, it could be better if the number of elements is large. As usual, you should check on your model and your specific case!

  • @heniekheniek1781
    @heniekheniek1781 4 ปีที่แล้ว

    This is great, thanks a lot!

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

    I want to filter one table (FactOpenItems[OpenValue_Open] with one column OR relationship between the other two tables (live DimSalesProcess[ProcessID], live DimPaymentInfo[PaymentType]. Can it be used for this as well? The two filter tables are related to the fact table.

  • @samirkumar6180
    @samirkumar6180 4 ปีที่แล้ว

    Hi alberto, is there any way i can make my report calculate ytd, mtd and ,qtd and wtd values from financial year considering 01-apr as the starting month of the year and 31-mar of next year as end month of the year...??

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

      There is an additional parameter in standard time intelligence functions, but you cannot use them for week calculations. See www.daxpatterns.com/time-patterns/ for all the possible combinations.

    • @samirkumar6180
      @samirkumar6180 4 ปีที่แล้ว

      @@SQLBI many thanks for the reply, will check the link surely

  • @rauljimenez5485
    @rauljimenez5485 4 ปีที่แล้ว

    Great information!!! In terms of performance, how does TREATAS compare to using "FILTER" or "CALCULATETABLE"?

  • @1yyymmmddd
    @1yyymmmddd 4 ปีที่แล้ว

    I guess that Power BI internally translates all the relationships into respective TREATAS functions when building queries, isn't it?

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

      No, technically it works in a different way, but details about the query plan could change over time so don't rely too much on them.

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

    In terms of performance, how faster (%) can TREATAS be when compared to "IN" approach?

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

      It depends, it could be relevant for large sets. Test the performance on your model and your specific case!

  • @galatemalate1256
    @galatemalate1256 4 ปีที่แล้ว +2

    When the formula had only year I was like meh... then it was used year+month and I was like WHAAAAAAATT

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

    Hi Alberto, Thank you for your sharing.
    I have difficulty to understand the following situation. I wonder if you have help me out.
    At 0:11, we can see the Sales 2007-2008 is always 21,237,259.11 for each row and this is expected.
    Note: This is because the context Year Number from the CALCULATE overwrites the Year Number from the Row Context if I understand correctly.
    I understand I can user KEEPFILTERS if I don't want 21M (total sales for 2007 and 2008) for each row and I want Sales for each individual year.
    Year Number Sales Amount Sales 2007-2008
    -------------------- ----------------------- ---------------------------
    2007 11,309,946.12 21,237,529.11
    2008 9,927,582.99 21,237,529.11
    2009 9,353,814.87 21,237,529.11
    -------------------- ---------------------- -----------------------
    Total 30,591,343.98 21,237,529.11
    where
    Sales 2007-2008 =
    CALCULATE(
    [Sales Amount],
    'Date'[Year Number] IN { 2007, 2008 }
    )
    However, if I create the similar table using "Calendar Year" instead of "Year Number"
    then I expect the same behaviors but the Sales CY 2007-2008 is not 21,237,259.11 for each row. Do you know why?
    Calendar Year Sales Amount Sales CY 2007-2008
    ---------------------- ---------------------- --------------------------
    CY 2007 11,309,946.12 11,309,946.12 (expect 21,237,529.11)
    CY 2008 9,927,582.99 9,927,582.99 (expect 21,237,529.11)
    CY 2009 9,353,814.87 (expect 21,237,529.11)

    ---------------------- ----------------------- -------------------------
    Total 30,591,343.98 21,237,529.11
    Where
    Sales CY 2007-2008 =
    CALCULATE(
    [Sales Amount],
    'Date'[Calendar Year] IN { "CY 2007", "CY 2008" }
    )
    Note: The only difference between the two tables is "Year Number" which is defined as numbers and "Calendar Year which is defined as characters.
    Please note that similar behavior occurs for Fiscal Year.
    Thanks,
    Lawrence