Forum Discussion
Lookup Value From Within Virtual Table
- 7 months ago
Hi diablo9081
You could perform a lookup-equivalent with an expression like this:
SELECTCOLUMNS ( FILTER ( __DataTransformT0, [v_Clinic_Decode] = "<LOOKUP_VALUE>" ), [ClusterId] )Assuming
__DataTransformT0is guaranteed to contain at most one row perv_Clinic_Decode(which should be the case here), this would return a 1x1 table (orBLANK) which is automatically converted to a scalar value where required.Alternatively, you could consider using
DEFINE TABLErather thanDEFINE VARfor__DataTransformT0which would create a table for the duration of the query. You could then reference this table as though it were a model table in an expression like this:LOOKUPVALUE ( __DataTransformT0[ClusterId], __DataTransformT0[v_Clinic_Decode], "<LOOKUP_VALUE>" ) )See here.
Hi diablo9081
You could perform a lookup-equivalent with an expression like this:
SELECTCOLUMNS (
FILTER ( __DataTransformT0, [v_Clinic_Decode] = "<LOOKUP_VALUE>" ),
[ClusterId]
)
Assuming __DataTransformT0 is guaranteed to contain at most one row per v_Clinic_Decode (which should be the case here), this would return a 1x1 table (or BLANK) which is automatically converted to a scalar value where required.
Alternatively, you could consider using DEFINE TABLE rather than DEFINE VAR for __DataTransformT0 which would create a table for the duration of the query. You could then reference this table as though it were a model table in an expression like this:
LOOKUPVALUE (
__DataTransformT0[ClusterId],
__DataTransformT0[v_Clinic_Decode], "<LOOKUP_VALUE>" )
)
See here.