Forum Discussion
diaz_edinson
5 years agoFrequent Visitor
Multiple True / False filter expression
Hi, I am trying to create a measure that sums the cost values, filtering by string type columns that contain certain parameters, however, although the measure theoretically has no errors, it is givi...
- 5 years ago
the reason I used CONTAINSSTRING is that the text contains the arguments "ff" or "do". but I solved it using this:
Cost = VAR NESFF = CALCULATE( SUM(FACTS[Cost]), FILTER( FACTS, IF( CONTAINSSTRING(LOWER(FACTS[Campaign name]),"ff") || CONTAINSSTRING(LOWER(FACTS[Creative]),"ff") || CONTAINSSTRING(LOWER(FACTS[Ad content]),"ff") || CONTAINSSTRING(LOWER(FACTS[Ad content]),"PUB"), 1, 0 )=0 ) ) RETURN NESFFRegards
Anonymous
5 years agoNot applicable
HI diaz_edinson,
I'm not so sure why you keeping used CONTAINSSTRING functions. In fact, you can write a filter function to append with these conditions. Please try to use the following measure formula if it helps:
COST =
CALCULATE (
SUM ( FACTS[Cost] ),
FILTER (
ALLSELECTED ( FACTS ),
LOWER ( FACTS[Campaign name] ) = "ff"
|| LOWER ( FACTS[Creative] ) = "ff"
|| LOWER ( FACTS[CONTENIDO] ) = "ff"
|| AND (
LOWER ( FACTS[Campaign name] ) = "pub",
LOWER ( FACTS[Funnel Stage] ) = "do"
)
)
)
If above not works, can please share some dummy data with a similar data structure and expected results? It should help us clarify your scenario and test to coding formula.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
diaz_edinson
5 years agoFrequent Visitor
the reason I used CONTAINSSTRING is that the text contains the arguments "ff" or "do". but I solved it using this:
Cost =
VAR NESFF =
CALCULATE(
SUM(FACTS[Cost]),
FILTER(
FACTS,
IF(
CONTAINSSTRING(LOWER(FACTS[Campaign name]),"ff") ||
CONTAINSSTRING(LOWER(FACTS[Creative]),"ff") ||
CONTAINSSTRING(LOWER(FACTS[Ad content]),"ff") ||
CONTAINSSTRING(LOWER(FACTS[Ad content]),"PUB"), 1, 0
)=0
)
)
RETURN
NESFF
Regards