$0 gifts vs NULL gifts

I was tinkering on one of my dashboards and noticed something peculiar. 

I was trying to see the number of orders WITHOUT a contribution, which I figured would be as simple as saying "[Count (ORDER ID)] , [Amount = $0]). That, however, returns the same number as the [# of Unique Order IDs], which shouldn't happen. It seems to be having some cognitive dissonance by saying "The number of total orders (without any considerations) is X. The number of total orders with a gift attached is Y (smaller than X). The number of Total orders without a gift is X". Those things can't all be true.

I tried to say "count the orders where the Gift Amount is NULL", but it wouldn't take that with bucketing. I tried to get fancy with the following formula:

SUM ( [Order ID] ,
IF (
( ISNULL([Total Contribution Amount]) )
, 1
, NULL
)
)

But that returns Null in the widget:

When I switch it to 'COUNT (Order ID)...' it returns 0.

I could take the formula I think works (# of orders , contribution > 0) and subtract it from the total order count, but there has to be a reason why the logic works like I'm seeing.

  1. How can the statements "The number of total orders (without any considerations) is X. The number of total orders with a gift attached is Y (smaller than X). The number of Total orders without a gift is X." be all true?
  2. How can I most cleanly craft a formula that asks "How many order DID NOT have a contribution on them?" 
Parents
  • Hi Nathanael,

    1. Within every Order ID exists rows with a Contribution Amount = 0 and you're intended to return Order ID where not exists any row with a Contribution Amount > 0, or where the aggregation of all rows within the Order ID = 0.

    2. A quick way might be the total number of orders minus the number of orders that DO contain a contribution. However, in wanting to validate that...

    SUM ([Order ID],
    IF( [Total Contribution Amount] = 0
    ,1,0
    )
    )
Reply
  • Hi Nathanael,

    1. Within every Order ID exists rows with a Contribution Amount = 0 and you're intended to return Order ID where not exists any row with a Contribution Amount > 0, or where the aggregation of all rows within the Order ID = 0.

    2. A quick way might be the total number of orders minus the number of orders that DO contain a contribution. However, in wanting to validate that...

    SUM ([Order ID],
    IF( [Total Contribution Amount] = 0
    ,1,0
    )
    )
Children