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

Changing the sign of a value

Started by N013, 14 Nov 2008 07:57:10 AM

Previous topic - Next topic

N013

I am trying to change the sign of a data item (revenue amount). Currently, the value is a credit(negative) and I need the value to appear as positive for the report (if it is negative) and if it appears as a positive the value should be a negative.

The easiest way I thought would be to multiply the data item by a -1. However, the expression editor does not validate.

Also, I tried the abs() function but that will not give me a negative if the value is positive.

Anythoughts or comments would be greatly appreciated!


Stejawh

Multiplying by -1 is a way of doing this.  What is the expression that doesn't validate.  There must be something else wrong with the expression.

Cheers,

Steve

N013

This does not work...


(IF ([Period Amounts].[Period Amounts - All].[Fiscal Year] = ?Fiscal Year?)
Then
(IF ([ObjectCodeGroup] = 'Revenue')
Then
([Period Amounts].[Period Amounts - All].[YTD Amount - Period 12]*-1)
Else
([Period Amounts].[Period Amounts - All].[YTD Amount - Period 12])
)
Else
(0)
)


However, this does.


(IF ([Period Amounts].[Period Amounts - All].[Fiscal Year] = ?Fiscal Year?)
Then
(IF ([ObjectCodeGroup] = 'Revenue')
Then
(abs([Period Amounts].[Period Amounts - All].[YTD Amount - Period 12]))
Else
([Period Amounts].[Period Amounts - All].[YTD Amount - Period 12])
)
Else
(0)
)


N013

#3
This seems to work.

(IF ([Period Amounts].[Period Amounts - All].[Fiscal Year] = ?Fiscal Year?)
Then
(IF ([ObjectCodeGroup] = 'Revenue')
Then
(-[Period Amounts].[Period Amounts - All].[YTD Amount - Period 12])
Else
([Period Amounts].[Period Amounts - All].[YTD Amount - Period 12])
)
Else
(0)
)


Adding the negative sign in from of the data item seems to convert the sign like I want. Can you confirm this will give the desired result?

Stejawh

Hi,
Not knowing your data it's hard to say if this latest expression will perform how you want it to.  have you tested against a Negative and a Positive? if so does it convert ok?

I'm interested to know why the first example doesn't work.  Can you provide me with the error?

Thanks,

Steve