Skip to main content

I'm using a CASE WHEN statement to filter out dimensions based on dynamic criteria. For example, take the following case when statement:

 

CASE WHEN

"Activities"."ACTIVITY_EN" in ('Closed','Open')

THEN

'Closed'

END

 

I would expect that there will only be rows for 'Closed' and 'Open', however, I am also seeing a row with the dimension of '-' . There is no way to filter this out and leads to misleading dimensions.

Hi James,

 

CASE WHEN iterates through all rows in the table and returns a table of the same shape. This means that in effect and explicit ELSE null is returned for the rows that don't match your CASE WHEN statement.

 

You could filter out the null '-' rows via a component filter.


Hi @james.newma12 

 

As David said you can apply component Filter.

 

Following query will work I guess.

 

FILTER "Activities"."ACTIVITY_EN" IS NOT NULL;

 

Hope this works.

 

Happy Learning!


Reply