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

Complex Calculation JAN Current year - DEC Previous year

Started by Chamopak, 22 Jan 2020 07:27:47 AM

Previous topic - Next topic

Chamopak

I having a problem that occurs every January, due to the fact that the Previous Month is then Dec of the pervious year.

Currently I have the following (what is glowing is not working:

                                              [Selected Year]    |  [YearOrPrevMonth]  |        combination of([Selected Year],[Selected Month]) - combination of ([YearOrPrevMonth], [PrevMonth])
                                              [Selected Month]  |  [PrevMonth]            |
                                              [Actual]              |  [Atual]                    |                                                                                 [Atual]   
[Rows]
[Rows]
[Rows]
[Rows]

The calculation of [YearOrPrevMonth]:
if (
[Selected Month] = [Jan]
)
then
(
prevMember([SelectedYear])
)
else
(
[SelectedYear])



The calculation of[PrevMonth]:
if (
[Selected Month] = [Jan]
)
then
(
[Dec]
)
else
(
prevMemeber([Selected Month])
)




Can someone help me out of this?  I hope I am not the only one that ever had this problem.


Francis aka khayman

i see you are using dimensional reporting?

assuming you set up your date dimension the usual way, you don't need the if then else statement...
prevMember([Selected Month]) will always get the previous month

example:
[Selected Month] = [Feb 2020]
prevMember([Selected Month]) = [Jan 2020]

[Selected Month] = [Jan 2020]
prevMember([Selected Month]) = [Dec 2019]

etc

Chamopak

Quote from: Francis aka khayman on 22 Jan 2020 11:27:29 AM
i see you are using dimensional reporting?

assuming you set up your date dimension the usual way, you don't need the if then else statement...
prevMember([Selected Month]) will always get the previous month

example:
[Selected Month] = [Feb 2020]
prevMember([Selected Month]) = [Jan 2020]

[Selected Month] = [Jan 2020]
prevMember([Selected Month]) = [Dec 2019]

etc

Thanks, unfortunately the system is not that "nicely build" but I did find a solution :

if (?MonthPrompt? = [Jan])
then
(
tuple([PreviousYear],[Dec])
)
else
(
tuple([P_SelectedYear],[PrevMonth])
)



Only thing it shows the values correctly but the names are static like the Data Item

so now that is the next step to fix.