Skip to content

Instantly share code, notes, and snippets.

@pstoellberger
Created October 16, 2012 14:58
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save pstoellberger/3899805 to your computer and use it in GitHub Desktop.
Save pstoellberger/3899805 to your computer and use it in GitHub Desktop.
Conditional Formatting in Saiku
In the mondrian schema xml:
-----------------------------------------------------------------------------------------------------------
<CalculatedMember
name="Profit"
dimension="Measures">
<Formula>[Measures].[Store Sales] - [Measures].[Store Cost]</Formula>
<CalculatedMemberProperty name="FORMAT_STRING" expression="Iif(([Measures].[Store Sales] - [Measures].[Store Cost]) &lt; 10000, '|(#,##0.00 &#8364;)|style=red', '|#,##0.00 &#8364;|style=green')"/>
<CalculatedMemberProperty name="MEMBER_ORDINAL" value="4"/>
</CalculatedMember>
MDX Example:
-----------------------------------------------------------------------------------------------------------
WITH MEMBER Measures.ProfitFormatted as Measures.Profit, FORMAT_STRING = IIf(Measures.Profit > 2000, "|### €|style='lightgreen'|link='http://www\.analytical-labs\.com?profit\=" || Cast(Product.CurrentMember.Name as STRING) || "'|","|(### €)|style='red'|")
SELECT
NON EMPTY CrossJoin({[Gender].[All Gender].Children}, {[Measures].[ProfitFormatted]}) ON COLUMNS,
NON EMPTY {Hierarchize({[Product].[Product Category].Members})} ON ROWS
FROM [Sales]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment