issue: when I use treatas on a variable table within a measure I am seeing different behavior if I treatas the column to a fact or dimension table.
when I apply treatas to change the data lineage to the dimension table, the relationship does not hold and the filter from the dimension table is not considered.
However when the treatas is pointed at the fact table (which has a many to 1 relationship to the same dimension table) the behavior appears to work correctly.
is there something going on within treatas which requires a condition to work? Is it possible that if I am changing the data type within dax on the key this is messing it up?
I don't think its TREATAS messing things up, I just ran
DEFINE
VAR ProdKeys = { 599, 1885, 1895 }
EVALUATE
ROW(
"Using Product",
CALCULATE ( [Sales Amount], TREATAS ( ProdKeys, 'Product'[ProductKey] )),
"Using Sales",
CALCULATE ( [Sales Amount], TREATAS ( ProdKeys, 'Sales'[ProductKey] ))
)
on dax.do and it gave the same answer for both calculations, as expected.
What did you mean by changing the data type on the key ?
sure - here is an example of the measure i'm using
Do you have an example you can share ?
From what you've said it sounds like you are trying to define a table in a variable and then recalculate it using TREATAS. That won't work, a variable is only calculated once, when it is define. Trying to recalculate later won't change the result. Variables aren't really variable, they're more like constants.