If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

How Do I create a running total of unique values?

Started by bonfire09, 18 Oct 2017 11:37:14 PM

Previous topic - Next topic

bonfire09

I want something like this as shown below where I count the # of unique category values. I was  trying
count(distinct [category]) but it was not working.  Any help would be great thanks!
category count
a             1
a             0
b             1
b             0
a             0
c             1
c             0
c             0

MFGF

Quote from: bonfire09 on 18 Oct 2017 11:37:14 PM
I want something like this as shown below where I count the # of unique category values. I was  trying
count(distinct [category]) but it was not working.  Any help would be great thanks!
category count
a             1
a             0
b             1
b             0
a             0
c             1
c             0
c             0

How about total(1 for [category])

MF.
Meep!

bonfire09

Thanks! I tried this but it did not work. Instead I brought in another column and did a running count on that grouped by the category column. IE

running-count ( [data item] for [category]) which gave counts within category, and then created a new query calculation that had a case statement that said

case

     when running_count=1 then 1
else 0

end case.