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

Filter for the last 7 days

Started by Dampa, 10 Oct 2019 03:48:39 PM

Previous topic - Next topic

Dampa

Hi all,

I'm quite new with Cognos and I would need some tips before scheduling a report.

I would need to creare a filter so that only the last 7 days are displayed every time it runs.

The date is in the format yyyymmdd (i.e. 20191010). I'm assuming I need to convert the current date with that format and then take the range back to 20191010 - 7. At least this is what I'd do in Excel/Vba.

Thanks in advance for any advice you would share with me.

KR,
D

Francis aka khayman

convert to date and use _add_days

Dampa

#2
Hi Francis,

Thanks for your feedback.

As I was saying, I'm really new with Cognos. Should I use somethig like to_date([Date], 'YYYYMMDD')?

Edit: I've tried [Business Date] between current_date and _add_days(current_date,-7) without success, where Business date is the real date taken from YYYYDDMM

Thanks,
Daniele

Francis aka khayman

use cast.

btw, google is very useful to find these info.

dougp

That won't produce results.  I suspect lacking knowledge about Cognos is not the problem.  You need to know something about how to use a database.

Try this:

You appear to have the correct syntax for _add_days, but for future reference:

  • In Cognos, open the report in the report authoring tool.
  • Edit the data item you are having trouble with.
  • In the expression editor, open the functions tab - f(x).
  • Expand Business Date/Time Functions.
  • Click on _add_days.
  • Look at the Tips tab for a description of the _add_days function and examples of how to use it.

You also need to know how BETWEEN works.

  • In the expression editor, open the functions tab - f(x).
  • Expand Operators.

If that doesn't give you enough information:

  • Open a web browser.
  • Go to your favorite search engine.
  • Search for SQL between and whatever your RDBMS is.


Francis aka khayman

i'm a bit generous today

[Business Date] between _add_days(current_date,-7) and current_date