COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: sanchoniathon on 05 May 2015 10:59:33 PM

Title: SALES BEFORE and AFTER the selected date
Post by: sanchoniathon on 05 May 2015 10:59:33 PM
Hello to all,

1- We need to allow the user a date selection (a specific day)
2- We also need the user to enter a value that will represent the number of weeks that we want to compare. For example the user selected 1-Jan-2001 and entered the value 4 in the number
of weeks prompt, therefore we want to show the SALES$ 4 Weeks BEFORE the selected date and then 4 Weeks AFTER the same selected date.

Is this possible and how please describe.

Thanks !
Title: Re: SALES BEFORE and AFTER the selected date
Post by: schrotty on 06 May 2015 01:37:53 AM
Hello sanchoniathon,

i think this is simple.

A week is always 7 days, so you can multiplicate the numbers of weeks with 7 and add/subtract them to your selected date.

Filter condition:
[Your Date Field] between _add_days(?p_a_specific_day?; (?p_number_of_weeks? * -7)) and _add_days(?p_a_specific_day?; (?p_number_of_weeks? * 7))

:)

schrotty.
Title: Re: SALES BEFORE and AFTER the selected date
Post by: bvk.cognoise on 06 May 2015 01:39:07 AM
HI Sanchoniathon,

PFA XML hope it helps you or else you can try following expression

[Sales (query)].[Time].[Date] between _add_days (?Select Date?,-[Data Item1]) and  _add_days (?Select Date?,[Data Item1])

in Data Item1 use following expression

?number of weeks?*7


Regards
Bvk
Title: Re: SALES BEFORE and AFTER the selected date
Post by: schrotty on 06 May 2015 03:21:14 AM
hey Bvk,

same idea at the same time  :D
Title: Re: SALES BEFORE and AFTER the selected date
Post by: sanchoniathon on 08 May 2015 08:49:31 AM
Thanks to both of you ! 8)
Title: Re: SALES BEFORE and AFTER the selected date
Post by: sanchoniathon on 20 May 2015 11:32:59 AM
Hello agin,

By the way i need to have a COLUMN showing the sales a number of months BEFORE the selected Date  and another column showing the sales of a couple of months after that selected date.

SO both columns should be displayed next to each other the report. Is this still possible ?

Thanks !