Provides a JSON result that can be used with flex.bi Sparkline formatter.

Syntax

SparklineData( Set_Expression , Numeric_Expression )

Arguments


Set_Expression  MDX expression that returns a set over which to draw sparkline. Not mandatory for Sparkline bar.
Numeric_Expression  MDX expression that returns a number

Examples

It is possible to add Sparklines to Table and Gauge charts. This can be done with standard calculations or by manually writing a formula to return SparklineData.

  • The following formula could be formatted like a bar to show the difference between the measure on different rows visually:
SparklineData([Measures].[Invoice count] -- only numeric expression)
  • Similarly, the Invoice count trend can be put in a sparkline over a period of time:
SparklineData(
-- set of last 4 months counting from current month
  LastPeriods(4,
    [Time].[Month].CurrentDateMember
  ), 
-- numeric expression
  [Measures].[Invoice count]
)

The returned result by default would be the JSON, similar to the following.

[{"name":"Jan 2020","value":16.0,"formatted_value":"16"},{"name":"Feb 2020","value":8.0,"formatted_value":"8"},{"name":"Mar 2020","value":10.0,"formatted_value":"10"},{"name":"Apr 2020","value":9.0,"formatted_value":"9"}]

When you have double-checked that it is the correct data set, you can choose from Sparkline formatting options to display results.