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

Date calculation

Started by Roon3y, 02 Feb 2018 02:20:36 PM

Previous topic - Next topic

Roon3y

Simply this is what I have. Data item with a date (either 1st or 16th of the month).
What I'm trying to achieve is following:

When user run report for lets see 1/1/18, on the report id like to show "report ran for date 12/16/2017 to 12/31/2017"
if user runs for 1/16/18, report will show "1/1/18 to 1/15/18", if 2/1/18 then "1/16/18 - 1/31/18" so on and so forth.

How can I show this nicely? I sort of did a dirty if.. else but doesn't work for some reason.

Heres If.. else data item:

<RSClipboardFragment version="2.0"><dataItem name="Billing Days From"><expression>if ([Equipment - Cards].[AllTransactions].[Report Date] contains '16') then (cast(_add_days([Equipment - Cards].[AllTransactions].[Report Date],-15), char(10)))
else (cast(year([Equipment - Cards].[AllTransactions].[Report Date]),char(4)) + '-'+ trim(cast(month(_add_months([Equipment - Cards].[AllTransactions].[Report Date],-1)),char(2))) +'-'+ '16')</expression></dataItem><dataItem name="Billing Days To"><expression>if ([Equipment - Cards].[AllTransactions].[Report Date] contains '16') then (cast(_add_days([Equipment - Cards].[AllTransactions].[Report Date],-1), char(10)))
else (cast(_last_of_month ([Equipment - Cards].[AllTransactions].[Report Date]),char(15))) </expression></dataItem></RSClipboardFragment>

Please Let me know if y'all have any better way of doing.

Thanks