COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: tgs728 on 16 Mar 2014 02:24:14 PM

Title: distinct values for each month?
Post by: tgs728 on 16 Mar 2014 02:24:14 PM
HI all,
I have a requirement like below

category   month    id

ab               1           1
ab                1            2
AB               2             2
AB               2             3
AB              3               1
AB               3             2
AB               3           4


sO I WANT TO DISPLAY ONLY NEW VALUES FOR EVERY MONTH SO MY DESIRED OUTPUT SHOULD BE

category   month    id

ab               1           1
ab                1            2
AB               2             3
AB               3           4...


Please help me how to achieve this.need an urgent help..i am out of time..

Thanks ,

TGS
Title: Re: distinct values for each month?
Post by: navissar on 17 Mar 2014 12:23:24 AM
Hi,
This is an interesting requirement.
You did not specify whether you were over relational or dimensional. Due to the nature of your question I'll assume the first, note if you're on dimensional this method will not work, you'll need another way.
So, let's start with the basic scenario. I've recreated something similar over samples:
(http://i1269.photobucket.com/albums/jj597/navissar/Screenshot_031714_065614_AM_zps07c1e71d.jpg)
I marked in red the new rows I'd expect to see (The order method that appear for the first time). I'd expect the first month, and then only the rows in red.
Let's add the following data item, I named it "Order Method Index":
running-total(1 for [Order method type])
This will break down every occurrence of Order Method, and perform a running-total. See result:
(http://i1269.photobucket.com/albums/jj597/navissar/Screenshot_031714_071245_AM_zps4294bd4d.jpg)
But the interesting feature is what happens when a new month begins - see:
(http://i1269.photobucket.com/albums/jj597/navissar/Screenshot_031714_071513_AM_zpsa13ceeea.jpg)
When an order method that was already on a previous month is displayed on a new month, the enumeration continues. When a new Order Method is introduced, it is enumerated from the start (=1).
Next step - add a filter with the following:
[Order Method Index]=1
IMPORTANT: set the filter to operate AFTER AUTO-AGGREGATION.
Now we run the report and....
(http://i1269.photobucket.com/albums/jj597/navissar/Screenshot_031714_072011_AM_zps174e67af.jpg)


This should do it.
On a different note:
Quote from: tgs728 on 16 Mar 2014 02:24:14 PM
Please help me how to achieve this.need an urgent help..i am out of time..
Please don't do this. It may be perceived as rude and/or pushy. Please refer to the forum etiquette post section 2 (http://www.cognoise.com/index.php/topic,24030.0.html (http://www.cognoise.com/index.php/topic,24030.0.html))
Title: Re: distinct values for each month?
Post by: tgs728 on 18 Mar 2014 11:14:38 PM
Great idea... Thanks!!!!!
can you please tell me what happens running-total(1 for [Order method type])
normaly running total will add every row but how it break down for each order method.

Thanks
TGS
Title: Re: distinct values for each month?
Post by: navissar on 19 Mar 2014 02:34:36 AM
I'm sorry, I didn't understand that. Could you please explain your question again?