COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: lucky123 on 17 Dec 2013 02:36:04 PM

Title: Help with TopCount function
Post by: lucky123 on 17 Dec 2013 02:36:04 PM
All,
           I need to get the top 10 countries based on revenue for most recent year. I am using topCount function, I dont like to hard code the most recent year. Can you suggest any other way of doing?
Thanks

Here is an example
topCount(set([Camping Equipment],[Golf Equipment],[Mountaineering Equipment]),2,[2013])

I want to replace [2013] with a function that dynamically picks up the current hear. I have tried the head function and it is not working

Data:
                                  2013             2012               2011
Country
India                           1000            345                 963
Japan                          762              999                1962
United States              2000            1124               45
China                          567              786                 9999
Thailand                    10000            9876               1234

In the above example I want it to be sorted on 2013 data. Next Year The first column will be 2014 and I want it to be sorted on 2014 data.
Title: Re: Help with TopCount function
Post by: BigChris on 17 Dec 2013 03:53:08 PM
This might not be helpful, but the obvious answer is to get your data modeller / cube builder to create a current year dimension in your cube. There might be a function that you can use, but I'm afraid I don't know what it would be...I'd go back to the design of the cube.
Title: Re: Help with TopCount function
Post by: Francis aka khayman on 17 Dec 2013 07:36:00 PM
if your cube is designed such that the current year/month/date is the latest member of your time dimension you can use closingPeriod