I'm trying to dynamically apply a filter statement in DAX using the IN operator. By passing in a string of members to filter on.
In my scenario the fact table and DIM table do not have a relationship. After applying a context filter on DIM_VIEW[View] I want the selected members to be used to filter the fact table. Without relating the tables is this possible in DAX?
The DAX code below works when I filter one member however, it doesn't like multiple selections. The concatenatex() line correctly generates the member list but the IN operation does accept a dynamic input if there's more than one selection.
I have an issue when using this approach with time intelligence functions. It doesn't filter the correct values at the row level when the filter is selected for multiple members. It works fine if for example DIM_VIEW[View] is used as a dimension (on rows or columns) in my analysis because it can slice the values into their own buckets and know what dates are relevant for each view. While this works at the member level, the grand totals are wrong.
If all the members are selected as a filter, it aggregates the values up incorrectly without taking the individual D_VIEW[View] members into context, so the same result as the grand total is displayed.
I've managed to return the correct results in a DAX query however, I've been unable to translate this into a valid measure in my analysis that can apply the correct filtering.