Really well explained. I'm just curious why you would use treatas rather than creating a relationship between the two tables. Wouldn't treatas create performance problems? if you have a large data set. so my question is: When would treatas be of benift? And when would treatas be of disadvantage?
I wouldn't use TreatAs as the replacement of the relationship. I would still recommend to use the relationships whenever you can. However, there can be scenarios that depends on the situation, you might want to create a relationship at a different granularity than what exists in the model. using TreatAS with combination of functions such as Values you can do that, but in the actual relationship diagram that might mean a many-to-many relationship which is not ideal.
Reza : Great posting! 2 questions. What are the disadvantages of not having ANY relationship in the data model? Also, what are the orders of the columns you are trying to relate in treatas : do you start with the many side or with the one side. Great examples. Thanks
here is you can see another functions and explanations how to use them, if you dont have treat as, and also the difference in performance www.sqlbi.com/articles/propagate-filters-using-treatas-in-dax/
Definitely not recommended to not have relationships in the data model. Using the relationships you can easily understand what table filters what. without it, it will cause ambiguity. On the other hand, if you do not have relationships, then for every value, you need to write a measure with filtering (either with TREATAS or other DAX functions), vs, if you have relationships, many of values gets filtered themselves. TREATAS is not a remedy for relationship problems, it is another way of filtering.
It depends on how you use the treatas. If you use it just for a simple filtering like what I did in this video, then the result would be the same with or without the relationship.
Great explanation in 2023. Thank you
Glad it was helpful!
thank you for explaining in a very beginner friendly manner with many examples, other utube videos couldnt explain it so well
Interesting and helpful! I’m waiting for next video about multiple rows.
Awaesome tutirial !
explained properly
Nice Explanation...
Hello i have a questions , treatas admit a volumn with origin in function addcolumns??
Very good! Thanks dear Mr. Rad.
Really well explained. I'm just curious why you would use treatas rather than creating a relationship between the two tables.
Wouldn't treatas create performance problems? if you have a large data set.
so my question is:
When would treatas be of benift?
And when would treatas be of disadvantage?
I wouldn't use TreatAs as the replacement of the relationship.
I would still recommend to use the relationships whenever you can.
However, there can be scenarios that depends on the situation, you might want to create a relationship at a different granularity than what exists in the model. using TreatAS with combination of functions such as Values you can do that, but in the actual relationship diagram that might mean a many-to-many relationship which is not ideal.
Reza : Great posting! 2 questions. What are the disadvantages of not having ANY relationship in the data model? Also, what are the orders of the columns you are trying to relate in treatas : do you start with the many side or with the one side. Great examples. Thanks
here is you can see another functions and explanations how to use them, if you dont have treat as, and also the difference in performance www.sqlbi.com/articles/propagate-filters-using-treatas-in-dax/
Definitely not recommended to not have relationships in the data model. Using the relationships you can easily understand what table filters what. without it, it will cause ambiguity. On the other hand, if you do not have relationships, then for every value, you need to write a measure with filtering (either with TREATAS or other DAX functions), vs, if you have relationships, many of values gets filtered themselves.
TREATAS is not a remedy for relationship problems, it is another way of filtering.
@@zibroyd Thanks for the link. I will definably will take a look!
Thanks Reza.
Forgot to ask you , in excel 365 I don't have the treatas function. What other function can I use that simulate this behavior?
Because the main function of TREATAS is filtering, you can use FILTER instead in most of the occasions.
Got it.
What if you use TREATAS when the relationship exists?
It depends on how you use the treatas. If you use it just for a simple filtering like what I did in this video, then the result would be the same with or without the relationship.