)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Essential JS2

Syncfusion jQuery based widgets are no longer in active development. Switch to our pure JavaScript based next generation Essential JS 2 library.

Syncfusion Feedback

How to apply filter on percentage values through the OlapReport?

Platform: jQuery |
Control: ejPivotChart |
Published Date: July 16, 2015 |
Last Revised Date: June 17, 2019

This KB illustrates that how to apply filter on percentage values through the OlapReport.

Solution:

Generally, MDX query does not carry values having % symbol (for example, 15%) and so the filter operations using such values do not work properly. To overcome this problem, use fractional value to set the filter operand.  For example, you need to set 15% as 0.15.  Refer to the following OLAP Report that illustrates how to set the fractional value for filtering. 

C#

OlapReport olapReport = new OlapReport();
olapReport.Name = "Customer Report";
olapReport.CurrentCubeName = "Adventure Works";
DimensionElement dimensionElementColumn = new DimensionElement();
dimensionElementColumn.Name = "Customer";
dimensionElementColumn.AddLevel("Customer Geography", "Country");
MeasureElements measureElementColumn = new MeasureElements();
measureElementColumn.Elements.Add(new MeasureElement { Name = "Internet Sales Amount" });
DimensionElement dimensionElementRow = new DimensionElement();
dimensionElementRow.Name = " Product";
dimensionElementRow.AddLevel("Product Categories", "Category");
FilterElement filterElement = new FilterElement(AxisPosition.Categorical);
filterElement.Elements.Add(measureElementColumn);
filterElement.Elements.Add(dimensionElementColumn);
filterElement.FilterCase = FilterCase.GreaterThan;
filterElement.FilterValue.Add(new MeasureElement { Name = "Internet Sales Amount", Visible = true });
filterElement.FilterValue.Add(new FilterValue { Filter_Value = 0.02 });
filterElement.IsFilterCondition = true;
olapReport.CategoricalElements.Add(dimensionElementColumn);
olapReport.CategoricalElements.IsFilterOrSortOn = true;
olapReport.FilterElements.Add(filterElement);
olapReport.SeriesElements.Add(dimensionElementRow);

 

VB

Dim olapReport As OlapReport = New OlapReport()
olapReport.Name = "Customer Report"
olapReport.CurrentCubeName = "Adventure Works"
Dim dimensionElementColumn As DimensionElement = New DimensionElement()
dimensionElementColumn.Name = "Customer"
dimensionElementColumn.AddLevel("Customer Geography", "Country")
Dim measureElementColumn As MeasureElements = New MeasureElements()
measureElementColumn.Elements.Add(New MeasureElement With {.Name = "Internet Sales Amount"})
Dim dimensionElementRow As DimensionElement = New DimensionElement()
dimensionElementRow.Name = " Product"
dimensionElementRow.AddLevel("Product Categories", "Category")
Dim filterElement As FilterElement = New FilterElement(AxisPosition.Categorical)
filterElement.Elements.Add(measureElementColumn)
filterElement.Elements.Add(dimensionElementColumn)
filterElement.FilterCase = FilterCase.GreaterThan
filterElement.FilterValue.Add(New MeasureElement With {.Name = "Internet Sales Amount", .Visible = True})
filterElement.FilterValue.Add(New FilterValue With {.Filter_Value = 0.02})
filterElement.IsFilterCondition = True
olapReport.CategoricalElements.Add(dimensionElementColumn)
olapReport.CategoricalElements.IsFilterOrSortOn = True
olapReport.FilterElements.Add(filterElement)
olapReport.SeriesElements.Add(dimensionElementRow)

 

ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon