Forum Discussion
calculate with filter
- 9 years ago
only when i write 'ab' instead of the measure's valuee, the query result is correct.
As ConcatenateMEASURE is within the FILTER function, it will be evaluated for each row of the table2. So the result of ConcatenateMEASURE will be "ab" and "abc", not "ab".
In this scenario, using VAR function (whose value do not change once evaluated in the current context, even if the variable is referenced in another expression) should solve this issue. The formula below is for your reference.
= VAR ConcatenateValue = ConcatenateMEASURE RETURN CALCULATE ( SUM ( 'table1'[measure_from_table1] ), FILTER ( table2, string = ConcatenateValue ) )Regards
only when i write 'ab' instead of the measure's valuee, the query result is correct.
As ConcatenateMEASURE is within the FILTER function, it will be evaluated for each row of the table2. So the result of ConcatenateMEASURE will be "ab" and "abc", not "ab".
In this scenario, using VAR function (whose value do not change once evaluated in the current context, even if the variable is referenced in another expression) should solve this issue. The formula below is for your reference.
=
VAR ConcatenateValue = ConcatenateMEASURE
RETURN
CALCULATE (
SUM ( 'table1'[measure_from_table1] ),
FILTER ( table2, string = ConcatenateValue )
)Regards
- anthop8 years agoNew Member
Hello,
I am new to Power BI; I have only defined basic measures so far.
- I assume the code snippet (from = VAR) - correct?
- Where/How do we define ConcatenateMEASURE?
Thanks for your help!