Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
atanthony
Contributor II
Contributor II

Filter a dimension using an If OR statement

I want to filter a field on a bar chart using an If OR statement in expression editor. The field title is ActivityType, there are six different activities types. I want to filter on three of them.  This is what I enter in the expression editor:

    =if(ActivityType='Call' OR (ActivityType='Mailers' OR ActivityType='Drop-In', ActitityType)

This creates for the tress activity types, and a fourth bar that combines the value for all of the activities types.  The legend shows on the three activity types that I filtered on.  What do I need to do to exclude the fourth bar?

1 Solution

Accepted Solutions
devarasu07
Master II
Master II

Hi

try like this

Dimension:

=pick(match(ActivityType,'Call','Mailers','Drop-In'),'Call','Mailers','Drop-In')

// suppress null value in this dimension

measure:

sum(Amt)


and then enable total in your bar chart. thanks

Capture.JPG

Capture.JPG

Regards,

Deva


View solution in original post

8 Replies
luismadriz
Specialist
Specialist

HI,

Canyou please share the screenshot?

Maybe just this: =if(ActivityType='Call' OR ActivityType='Mailers' OR ActivityType='Drop-In', ActivityType)

luismadriz
Specialist
Specialist

Oh and more importantly don't include Nulls

devarasu07
Master II
Master II

Hi

try like this

Dimension:

=pick(match(ActivityType,'Call','Mailers','Drop-In'),'Call','Mailers','Drop-In')

// suppress null value in this dimension

measure:

sum(Amt)


and then enable total in your bar chart. thanks

Capture.JPG

Capture.JPG

Regards,

Deva


jonathandienst
Partner - Champion III
Partner - Champion III

A little simpler

=If(Match(ActivityType, 'Call', 'Mailers', 'Drop-In'), ActivityType)

(and suppress null values)

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
atanthony
Contributor II
Contributor II
Author

The attached docx file shows the expression and the resulting bar chart.  The gray at the top of each bar represents the other activity types.  The legend does not include these activity types. How can I exclude them from the bars?

atanthony
Contributor II
Contributor II
Author

Exactly what I need.  Thank you.

luismadriz
Specialist
Specialist

By not including nulls on the properties of that dimension

Untitled.png

I hope this helps,

Luis

luismadriz
Specialist
Specialist

And as per your screenshot, the dimension seems to be Day