Monday, February 20, 2012

MDX Lag and Font use

Hi all,
I have a cube with a Year Dimension and Month dimension (wanted
intersections).
Does anyone have a calc-cell example that would perform something akin to
the following.
If (Current month sales - Last Month Sales)/Current month sales >15% then
cell font color bold and green, else if (Current month sales - Last Month
Sales)/Current month sales <20% then cell font color bold and red, else
default.
Thanks in advance.Here's an example for Foodmart Sales cube:
[vbcol=seagreen]
With
Member [Measures].[SalesTrend]
as '([Measures].[Unit Sales]
- ([Measures].[Unit Sales], [Time].PrevMember))
/[Measures].[Unit Sales]',
FORMAT_STRING = 'Percent'
Cell Calculation [SalesFormat]
for '({[Measures].[Unit Sales]}, {[Time].[Month].M
embers})'
as 'CalculationPassValue([Measures].[Unit Sales], -1, RELATIVE)',
FORE_COLOR = 'iif([Measures].[SalesTrend] > 0.15,
rgb(0,128,0), iif([Measures].[SalesTrend] < -0.20,
rgb(255,0,0), rgb(0,0,0)))',
FONT_FLAGS = 'iif([Measures].[SalesTrend] > 0.15
Or [Measures].[SalesTrend] < -0.20, 1, 0)'
Select {[Measures].[Unit Sales], [Measures].[SalesTrend
]} on columns,
Descendants([Time].[1997], [Time].[Month]) on rows
from Sales[vbcol=seagreen]
- Deepak
Deepak Puri
Microsoft MVP - SQL Server
*** Sent via Developersdex http://www.codecomments.com ***
Don't just participate in USENET...get rewarded for it!

No comments:

Post a Comment