Not sure if this is to be in Reporter or Designer…but I’ll start here.
I have a couple counts that were created by consultants for me. Here is one of them:
count(distinct CASE WHEN A = 1 AND B = 1 AND
C = 1 AND D = 1 THEN XYZ ELSE NULL END)
If I run this over a time frame, and there are no cases where A,B,C,D are all true, this will give me a count of ‘zero’ sometimes. In my opinion it wouldn’t be possible if one or all of A,B,C,D are untrue. In that case it would be null, correct? Does anyone have any ideas?
If there are ROWS for that period, you will get a count of 0 or a valid count. If there are no ROWS, then you will get a NULL value. There has to be something to count (even the DUAL/DUMMY table contains a single row so that values will be returned).
Empty tables will return null counts (or no rows/no data to fetch). Keep in mind that a COUNT of any Oracle field is (by default) a count of NON-NULL rows. This differs slightly from the Count(*) or Count(1) that is typically used to return a count of rows.
Is there anyway to remove this from showing in the output? I know I can do a
=if xyz <> 0 then xyz
to not display it. But then I have an empty row of data. This gets very confusing for the user. Sometimes a count of zero is displayed for a date (or the date is shown with an empty…null…value), other times the date is simply not displayed as there is no data to fetch for that day.