Friday, March 9, 2012

FORMAT_STRING For Calculation

I have a calculation that gives the evolution of a certain measure over 1 month in percentage.

MAR2006 : 1000

APR2006: 1100

> calculation = 10%

MAR2006 : 1000

APR2006: 900

--> calculation = -10%

This works perfect ... but the users of my application ask me if I can put a '+' sign for positive evolutions.

In the first case they want to see '+10%' in stead of '10%'

This is the FORMAT_STRING I am using : "#0.00%"

Any idea ?

Hi Christophe,

You need to include two sections in your format string definition, the first for the positive values and the second for the negative values. Here's an example from Adventure Works which does what you want, I think:

with

member measures.test as (7000000 - [Measures].[Internet Sales Amount])/[Measures].[Internet Sales Amount]

, format_string='+#0.00%; -#0.00%'

select measures.test on 0,

[Date].[Calendar Year].members on 1

from [Adventure Works]

HTH,

Chris

|||

THANKS A LOT.

Just tested it and it works.

No comments:

Post a Comment