title: IBM Cognos Running-Total on a Distinct Count?
body: <p>This is for Cognos v.8 and I am unable to use SQL at my permission level.</p>
  
  <p>I've spent almost two whole days trying to figure out how to make this running-total function work in Cognos, but for some reason it will not work in this case. I've tried running-counts, running totals, every combination of the two...</p>
  
  <p>I'm trying to figure out specific count of type A items.</p>
  
  <p>Each item has their specific item code, and so I have a data item called [Special Indicator]:</p>
  
  <blockquote>
    <p>CASE
     WHEN [Item Code] IN ('A','B') THEN 'Special'
     WHEN [Item Code] = ('C') THEN NULL
    ELSE NULL END</p>
  </blockquote>
  
  <p>I have another data item used, [Special Items] to calculate the distinct count by type using a concatenation of classifying factors called [Item SuperID].</p>
  
  <blockquote>
    <p>IF ([Special Indicator] = 'Special') THEN ([Item SuperID])
    ELSE NULL END</p>
  </blockquote>
  
  <p>Finally, I have [Special Item Count]:</p>
  
  <blockquote>
    <p>count(distinct [Special Items] for [Inventory Date], [Warehouse])</p>
  </blockquote>
  
  <p>This gives me the correct count per day for each item.</p>
  
  <p>However if I do this, I do not get a running total of these counts:</p>
  
  <blockquote>
    <p>running-total([Special Item Count] for [Warehouse])</p>
  </blockquote>
  
  <p>My initial count for the first date is correct, but all counts for each consecutive date seems to be multiplying the initial count in multiples of random integers like 11, 19, or 23. </p>
  
  <p>Any idea on how I can get an accurate running count/total for each warehouse?</p>
  
  <p>My counts should say 40, 68, etc... but it's coming out as 40, 440, etc..</p>
  
  <p>Any help is GREATLY appreciated!!</p>