Тёмный

When to use KEEPFILTERS over iterators 

SQLBI
Подписаться 103 тыс.
Просмотров 47 тыс.
50% 1

How to use KEEPFILTERS in DAX iterator functions to preserve arbitrarily shaped filters in context transition.
Article and download: sql.bi/705054?aff=yt
How to learn DAX: www.sqlbi.com/guides/dax/?aff=yt
The definitive guide to DAX: www.sqlbi.com/books/the-defin...

Наука

Опубликовано:

 

26 апр 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 100   
@ZappPSR
@ZappPSR 3 года назад
"There are no dark forces in action" - LOL Every time I encounter something strange now I know that I must check filter context and not blame the occult! Thanks again Maestro for an excellent explanation!
@ajaaskelainen
@ajaaskelainen 2 года назад
True! for a long time I've avoided complicated situations like this. Now it is time be one with the force!
@anilyadav-rt4sr
@anilyadav-rt4sr 3 года назад
I think you are best teacher ever seen for DAX
@MrMalorian
@MrMalorian 3 года назад
Any video that talks about 'dax shenanigans' gets a like from me ;)
@danielsiffredi8403
@danielsiffredi8403 3 года назад
Filter context is the mother fr*ucker of the many issues I've encountered over the years while developing with DAX. - context transition is hard to explain and hard to learn - I wished we had this video +3 years ago , It's excellently explained maestro! may the daxforce be with you! :)
@tiffanyharris711
@tiffanyharris711 2 года назад
THIS IS MY MOST FAVORITE VIDEO YET! Thank you for taking the time to explain!!!!
@MariuszRepczynski
@MariuszRepczynski 3 года назад
Finally, I've seen use of keepfilters around tables in some of your article but never understood the reason behind it, thanks so much Alberto for explaining it, amazing video as always!
@roadtech6472
@roadtech6472 3 года назад
That's the most important thing for "DAX coders": dominate the filter context and context transition. You do it as a master! Congrats Alberto and thanks for sharing knowledge! I love to learn with SQLBI videos.
@granthunking6214
@granthunking6214 2 года назад
Brilliant explanation - this is pure DAX gold. Thank you, sir!
@officesuperhero9611
@officesuperhero9611 3 года назад
Once again, the master has spoken and imparted his knowledge on me. THANK YOU!! Great explanation. And I have gotten those wrong calculations and could not figure out why!
@beginho2454
@beginho2454 3 года назад
you are so generous. great teacher!
@shailendrarajput4565
@shailendrarajput4565 3 года назад
I watch every video ...You are teaching the roots of DAX...thank u so much for all ur efforts and good work
@lodingwai
@lodingwai 2 года назад
Thanks Alberto for the clear explanation (also helps to start from the very beginning). I just rewatched this video after going through the example in the module from the video course. Marco also did a great job and watching this video right after really helps reinforce the knowledge. Keep up the good work! - DAX novice in training
@Wzxxx
@Wzxxx Год назад
Well explained!!!! Perfectly. It is also the best explanation what is the filter context transition. It should be be in a tittle as well! It is one of the best videos on SQLBI. I love the way you explained all filtering section with drawings.
@beginho2454
@beginho2454 3 года назад
Thanks DAX Guru, can not say more thanks to you and your team :)
@mwaltercpa
@mwaltercpa 6 месяцев назад
So much depth in this topic and explanation. Thanks Alberto!
@cptdeadeye2112
@cptdeadeye2112 3 года назад
Thank you. I couldn't get a good explanation for KEEPFILTERS for a very long time.
@bravucod
@bravucod 3 года назад
Phephenomenal video! I was always having a tough time understanding context transition.
@randomindex
@randomindex 3 года назад
Very helpful! Thank you Alberto and team!
@marciobina
@marciobina 3 года назад
That's an amazing explanation! Thanks, Alberto!
@marounsader318
@marounsader318 3 года назад
mind blown, the explanation is so smooth thank you alberto!
@cecinati
@cecinati 3 года назад
Thanks Alberto! This video looks tailor-made over an issue I had right this morning!
@ronand8936
@ronand8936 2 года назад
Excellent article this - a light went off in my head !
@BISimplifier
@BISimplifier Год назад
Excellent. The best explanation on the planet.
@mikeycbd
@mikeycbd 9 месяцев назад
This is GOLD! Thank you soooo much from Melbourne down under. ✍
@88packito88
@88packito88 3 года назад
Thanks Alberto. You're a genius. Very well explained!
@pedropradocarvalho
@pedropradocarvalho 3 года назад
Great video, I absolutely love those theory videos! Thanks!
@sandeepbarge4699
@sandeepbarge4699 3 года назад
Great Video! Please let more such videos come in. I firmly believe that we can solve complex problems if we are clear qith basics and theory! Thanks!
@divakarkrishnan6954
@divakarkrishnan6954 3 года назад
Wow.. You and Marco are the god of DAX... :)
@namdaohoang7852
@namdaohoang7852 2 года назад
Very clear and intuitive explanation, Sir! Subscribed
@mohanadmohamed5501
@mohanadmohamed5501 2 года назад
What a detailed and clear explanation. By the way, while I was doing some practice on KEEPFILTERS, I discovered that only if we use YEAR & MONTH hierarchy in the Filter Context, in both Matrix and Slicer, the result will be correct without the need to use KEEPFILTERS. But I don't know why. I hope you explain this scenario in some of details. THANK YOU for the grate videos
@baskis69
@baskis69 3 года назад
Que manera de explicar tan clara¡¡¡ Grazie mille maestro¡¡¡¡
@Luis.C.Canchan
@Luis.C.Canchan Год назад
Eres genial Alberto, todos tus videos son grandiosos!!! Saludos dese Perú 🇵🇪
@lbarbyery
@lbarbyery 3 года назад
I really liked this type of video. This is one of best of chanel. There some things em DAX tha we need to explain in a deep details and this diagrams step-by-step are a great way to understand. Thanks a lot!
@Bharath_PBI
@Bharath_PBI 3 года назад
Very useful. Thank you as always 👍
@justFast1k
@justFast1k 3 года назад
this is amazing! more "boring" theory :) thank you for your knowledge!
@questionsformedb8157
@questionsformedb8157 3 года назад
Absolute masters!
@mnowako
@mnowako 3 года назад
Superb and very useful 👍 Thank you.
@carlosch1807
@carlosch1807 2 года назад
Thanks!!!! You save my life.... Again LOL
@sambasivarao576
@sambasivarao576 3 года назад
I loved it!
@diegomex85
@diegomex85 3 года назад
just amazing =)
@shashankpandey1019
@shashankpandey1019 5 месяцев назад
Awesome Awesome Awesome 👍👏
@sbn4862
@sbn4862 2 года назад
Thank you very much
@henriquerabello8924
@henriquerabello8924 10 месяцев назад
Excelente explicação!
@MrAstonmartin78
@MrAstonmartin78 2 месяца назад
SuperVideo. Thanks
@quickfocus1147
@quickfocus1147 3 года назад
Awesome!
@glauberversiano1200
@glauberversiano1200 Год назад
Sensacional!!!
@julie_chen
@julie_chen Год назад
Thank you🙏🙏🙏🙏
@3danim8r1
@3danim8r1 3 года назад
Great..👍👍👍
@Milhouse77BS
@Milhouse77BS 3 года назад
"DAX shenanigans" :) at 2:58
@cathrerinezetadrones3169
@cathrerinezetadrones3169 Год назад
Great!!
@ed2921
@ed2921 3 года назад
Masterful
@goldwhispers
@goldwhispers 3 года назад
oh this is fab! dax enjoyed! ciao
@DIGITAL_COOKING
@DIGITAL_COOKING 3 года назад
I'm sure that others MVP'S owners of RU-vid channels benefits from this channels like us but i don't come across with their comments here, when they ask for their channels , this is not fair. Thanks Marco and Alberto
@lukeminikoski
@lukeminikoski 3 года назад
Great!
@pbihari0214
@pbihari0214 3 года назад
thank you
@rakkhnaka
@rakkhnaka 2 года назад
I ran into a similar problem sometime back, and started blaming SUMX function as buggy.
@PeterKontogeorgis
@PeterKontogeorgis 3 года назад
Thank you for another great video. I assume the second filter context which is generated on transition is only month due to the VALUES (Month) in the averageX. If the AVERAGEX iterated on VALUES ( Year-month) instead of just Month, would that avoid the issue?
@SQLBI
@SQLBI 3 года назад
Correct!
@frankgovers8420
@frankgovers8420 3 года назад
Again great Alberto. But should this behaviour of keepfilters not be automatically in a hiërarchiek slicer?? At the total row? Also, I have a little problem with variables! When i use the external measures, very basic, it works But when i uses this measures in a variable , it gives the wrong result. I tried everything, also, extra calculate around the variables, but still, no go. No one can solve this basic problem. Will you give it a trie in a video?! Last question, do you ride a maserati? 😀
@agasti2007
@agasti2007 3 года назад
Hi Alberto, not sure I got you there. In the example you said that “Novemeber” was used together with the combination of the filters applied on year. Thus what we see is nov 2007 and nov 2008 combined together. But the filter passed to averagex in the first iteration was year = 2007 and month = nov. How did calculate see both the years then? I guess, and correct me if I’m wrong - the filter on year was simply wiped off and only the month was retained since the calculate is built in top if that. I also think your sample DB contains just these 2 yrs, because of which the value corresponds to the aggregation of these 2 years. Cheers.
@feng3625
@feng3625 2 года назад
How about Sep. New update for Calculate, please teach us more on this.
@majedalhussan3082
@majedalhussan3082 3 года назад
Thank for the information, amazing as usual , however it's seem to me the link is not working for article .
@SQLBI
@SQLBI 3 года назад
The link works - can you try again? What error do you get?
@joelguay4452
@joelguay4452 3 года назад
So if a [Date Month] Column was used {2007-11-01,2007-12-01,2008-01-01,2008-02-01} instead of a Textual Month (so unique values per month) in the "Values" of the function, it would have iterated discrete values and solved the issue without complexifying the code. But I get the point of the exercice for demonstration purpose :) Well done as usual !
@SQLBI
@SQLBI 3 года назад
Correct!
@KgasS
@KgasS Год назад
This is one solution. The same effect is there on using a Year-Month hierarchy.
@universalproblemsolver
@universalproblemsolver 3 года назад
Thank you Alberto. Q: Is there an easy way to see the filter context in action? Like a debug for External/Internal context and Context Transition? Or something like an Execution Plan in SQL Server?
@SQLBI
@SQLBI 3 года назад
Read this article+video: www.sqlbi.com/articles/displaying-filter-context-in-power-bi-tooltips/
@dbszepesi
@dbszepesi 3 года назад
Alberto - have you ever covered how you use a tablet and stylus to annotate your visuals in one of your videos? This would be really useful to use as a whiteboard in meetings.
@SQLBI
@SQLBI 3 года назад
See this: www.sqlbi.com/blog/alberto/2021/02/14/on-my-recording-gear/
@LurchMichal
@LurchMichal 3 года назад
Great video as always :) I have a question: let's say we have Sales Amount measure calculated as SUMX (multiplying net price and quantity). Is it better to have it as this measure in model or precompute in ETL and load to Tabular as ready column? So trade off would be bigger model vs need to calculate it on the fly.
@SQLBI
@SQLBI 3 года назад
It depends. In general, it's better to save storage and use the two columns, which result in a better compression compared to a single column with the result. In a very large model (billions of rows), precomputing the result of the multiplication could be better for both performance and storage. The balance point depend on the number of unique values and it's hard to estimate, it should be analyzed model by model. However, for tables that have only a few million rows usually it is better to perform the multiplication at query time and save storage.
@LurchMichal
@LurchMichal 3 года назад
@@SQLBI thank you very much
@user-gd1wm6gi8h
@user-gd1wm6gi8h 3 года назад
You are the best! Help me a lot But why in the mouth its work perfect?
@sbn4862
@sbn4862 2 года назад
How about it calculate ( divide(sales[sales amount], countrows(values(date[Month]) Could be it analog to your method ?
@scottwilliams6741
@scottwilliams6741 9 месяцев назад
Great help, Alberto! Thank you! Is there a reason that I wouldn't use this on every Calculate formula?
@SQLBI
@SQLBI 9 месяцев назад
It depends on the purpose of the filter. As a rule of thumb, you often want to use KEEPFILTERS for a range of values (e.g. >=) and you don't want to use KEEPFILTERS for a single value (e.g. =) but there are certainly exceptions to this "rule".
@scottwilliams6741
@scottwilliams6741 9 месяцев назад
Thank you for this clarity! Great help!!
@paulomartins1008
@paulomartins1008 2 года назад
The lesson always seems to be, if you're code is wrong stop and go study. 😁
@Wzxxx
@Wzxxx Год назад
I still don't understand one thing . If we used KEEPFILTERS why does it work properly? as we only have month filter (ie.November) coming from context transition for iteration #1 so it only should KEEPFILTERS (takes mutual part) for month column, from outer filter context not a year column (from outer filter context) ?
@sokgat7019
@sokgat7019 3 года назад
Love it!!! There is not dark forces in action!!!
@cartierdeclaration9029
@cartierdeclaration9029 2 года назад
Hi Alberto, What if you replaced month with yearmonth. Would that solve the problem on a total level? you have a unique value for each year month combination.
@SQLBI
@SQLBI 2 года назад
Yes filtering a single column is always better!
@KgasS
@KgasS Год назад
Thanks for the insight on KEEPFILTERS. one interesting aspect noticed is if a year month hierarchy is used then the problem is not appearing. Someone can confirm this.
@SQLBI
@SQLBI Год назад
Because you have a single column filter, in that case you don't have an arbitrary shaped filter that would be partially broken by the filter overwrite.
@KgasS
@KgasS Год назад
@@SQLBI Thanks for the clarification.
@alessandrocadenelli5849
@alessandrocadenelli5849 3 года назад
PLOT TWIST "The problem is not DAX...Is you."
@julienjacquemont6048
@julienjacquemont6048 Год назад
Hi Alberto, First of all, Thank you for all your videos, It's a great pleasure for me to learn DAX with SQLBI. I have a question about your explanation of the Context Transition in the Timestamp 10:55 of the video : I don't understand why context transition operate only on the Month column. Intuitively (And maybe there is my error), When I read the report in the example , the New filter resulting of the context transition is 'Date'[Month] = November AND 'Date'[Year] = 2017. Of course is false. Could you help me to understand my error? Again thank You for your work, Juilen JACQUEMONT
@SQLBI
@SQLBI Год назад
The year filter is there because of the original filter context. The iterator transforms only the columns in the row context into an equivalent filter context - the Month column, indeed.
@edoardopregno3949
@edoardopregno3949 3 года назад
Values (year month) instead of keepfilter?
@SQLBI
@SQLBI 3 года назад
Correct! A proper data model always saves you - but if you don't have the YearMonth column, KEEPFILTERS becomes necessary.
@gabriellegall8278
@gabriellegall8278 2 года назад
Isn't it simpler to do : Monthly Average = AVERAGEX ( SUMMARIZE('Date', 'Date'[Month], 'Date'[Calendar Year] ), [Sales Amount] ) ?
@kondziunia
@kondziunia 3 года назад
Extra!
@user-yo2nb4ry7i
@user-yo2nb4ry7i 3 года назад
Норм!!! 📌
@mathijs9365
@mathijs9365 2 года назад
How to explain something simpel more difficult.
@Wzxxx
@Wzxxx 2 месяца назад
I am back after a year and still don’t understand one thing where this logic doesn’t work on subtotal if we iterate with years. I read sqlbi and a dax bible but it doesn’t cover this. What is the filter context for ie subtotal 2008? I guess it is 2008 - Jan and 2008 - Feb. So iteration over values (years) according to this logic should iterate over 2008 only but it doesn’t work and gives wrong result. Somehing is worng here at subtotal level. The filter context from a table doeas not work as expected
@SQLBI
@SQLBI 2 месяца назад
It's better if you comment below the related article, for complex answers we do not use RU-vid comments. It's also better if you clarify the exact formula and point in the article, that's also the reason why we prefer to comment there. Thanks!
Далее
Using ALLEXCEPT vs ALL VALUES
13:35
Просмотров 52 тыс.
Solving errors in CALCULATE filter arguments
30:55
Просмотров 26 тыс.
Olive can see you 😱
01:00
Просмотров 8 млн
когда повзрослела // EVA mash
00:40
Просмотров 664 тыс.
Turning trash into triumph, one can at a time!
00:18
Просмотров 3,2 млн
Understanding DAX Filter Context and Incorrect Totals
53:50
Variables in DAX
16:46
Просмотров 32 тыс.
Using KEEPFILTERS in DAX
14:22
Просмотров 25 тыс.
Differences between GROUPBY and SUMMARIZE
28:30
Просмотров 33 тыс.
Using calculation groups in DAX
41:59
Просмотров 20 тыс.
Row Context in DAX
20:42
Просмотров 92 тыс.
Best practices for using KEEPFILTERS in DAX
28:24
Просмотров 9 тыс.
APPLE совершила РЕВОЛЮЦИЮ!
0:39
Просмотров 3,8 млн
Кто производит iPhone?
0:59
Просмотров 243 тыс.