During a conversation at PASS Summit, one of the developers of Power BI shown me a way to use TREATAS in place of IN in DAX. I am not sure it increases readability of the code, but let’s examine pros and cons.
Spoiler: you should continue to use IN for simple filters!
The following syntax generates a table with two brands.
EVALUATE FILTER ( ALL ( 'Product'[Brand] ), 'Product'[Brand] IN { "Contoso", "Fabrikam" } )
You can obtain the same result using TREATS in a creative way:
EVALUATE TREATAS ( { "Contoso", "Fabrikam" }, 'Product'[Brand] )
When used in a measure, the two syntaxes appear much more similar.
Products Special Brands := CALCULATE ( DISTINCTCOUNT ( 'Product'[Color] ), 'Product'[Brand] IN { "Contoso", "Fabrikam" } ) Products Special Brands 2 := CALCULATE ( DISTINCTCOUNT ( 'Product'[Color] ), TREATAS ( { "Contoso", "Fabrikam" }, 'Product'[Brand] ) )
The two measures above create this simple report.
I investigated the query plans of the two options. The resulting performance is very similar, probably I should have used a larger dataset for a serious test. But the query plan for TREATAS results in a more complex calculation in these two examples.
I also used variants using KEEPFILTERS, but the physical query plan is constantly more expensive using TREATAS rather than the simpler and more intuitive IN syntax.
My conclusion is that TREATAS should be used only to transfer filter in “virtual” relationship, and not as an alternative to traditional filters that are better supported for ordinary DAX syntax. You can test the same queries in this Power BI workbook.