Forum Discussion
Switch function based on selection filter to another table value
- 3 years ago
Hi Tevon713
This error occurs because Table2[Region]=[Selected_Measure] portion is used as a filter expression in CALCULATE function. To avoid this error, you can try the following measure. Add a variable to get the measure value in advance, then use the value in CALCULATE.
Matches Count = VAR __value = [Selected_Measure] RETURN CALCULATE ( DISTINCTCOUNT ( Table2[Acct Num] ), FILTER ( Table2, LOOKUPVALUE ( Table1[Acct Num], Table1[Acct Num], Table2[Acct Num] ) ), Table2[Region] = __value )Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it. Highly appreciate your Kudos!
Thanks v-jingzhang.
Tried previously. I'm getting this message when trying to use it return value. Intent is to look for if that account number exist in another table for that selected region.
A function 'PLACEHOLDER' has been used in a True/False expression that is used as a table filter expression. This is not allowed.
Matches Count = CALCULATE(DISTINCTCOUNT(Table2[Acct Num]) , FILTER(Table2,LOOKUPVALUE(Table1[Acct Num],Table1[Acct Num], Table2[Acct Num])), Table2[Region]=[Selected_Measure])
Hi,
To overcome this error, you may also use FILTER function instead of direct filter expression. Filteration in measures does not work directly in expression, but works with FILTER function.
Example: Replace with below.
FILTER(Table2, [Region]=[Selected_Measure])