How to customize the cell value in OLAP grid control
Formatting cell values in terms of thousands and millions
You can define any custom format for cell values in the OLAP grid. To set the custom format, the Format property of corresponding element should be specified as Custom and the desired format should be assigned using the FormatString property.
The following formats are used to format the cell values of the OLAP grid in terms of thousands and millions:
- Thousands - “# ###0,”
- Millions - “# ###0,,”
Refer to the following code sample to format the measure elements like ‘Sales Amount’ in terms of thousands and ‘Internet Sales Amount’ in terms of millions.
[C#]
OlapReport olapReport = new OlapReport(); MeasureElements measureElementGroup = new MeasureElements(); measureElementGroup.Elements.Add(new MeasureElement() { ElementName = "Sales Amount", Format = NumberFormat.Custom, FormatString = "# ###0," + " K€" }); measureElementGroup.Elements.Add(new MeasureElement() { ElementName = "Internet Sales Amount", Format = NumberFormat.Custom, FormatString = "# ###0,," + " M€" }); olapReport.CategoricalElements.Add(measureElementGroup); |
[VB]
Dim olapReport As New OlapReport() Dim measureElementGroup As New MeasureElements() measureElementGroup.Elements.Add(New MeasureElement() With {.ElementName = "Sales Amount", .Format = NumberFormat.Custom, .FormatString = "# ###0," & " K€"}) measureElementGroup.Elements.Add(New MeasureElement() With {.ElementName = "Internet Sales Amount", .Format = NumberFormat.Custom, .FormatString = "# ###0,," & " M€"}) olapReport.CategoricalElements.Add(measureElementGroup) |

OLAP grid before applying the custom format

OLAP grid after applying the custom format