I am trying to create a stored procedure (using an example from the book) that retrives product items which sales volume variance is below certain level using the following code:
Public Shared Function FindLowVarEntries(ByVal InputProductSet As [Set], ByVal InputTimeSet As String, ByVal SalesVolume As String, ByVal VarLowLimit As Decimal) As [Set]Dim oMDXVal As MDXValue, oResSet As SetBuilder = New SetBuilderDim oTuple As Tuple, strContext As String, oExp As Expression = New ExpressionFor Each oTuple In InputProductSet.Tuples strContext = GetCurrentContextFromTuple(oTuple) oExp.ExpressionText = "Var( " & InputTimeSet & ", " & SalesVolume & ")" oMDXVal = oExp.Calculate(oTuple) If oMDXVal.ToDecimal <= VarLowLimit Then oResSet.Add(oTuple) End IfNext oTupleReturn oResSet.ToSetEnd Function
Public Shared Function FindLowVarEntries(ByVal InputProductSet As [Set], ByVal InputTimeSet As String, ByVal SalesVolume As String, ByVal VarLowLimit As Decimal) As [Set]
Dim oMDXVal As MDXValue, oResSet As SetBuilder = New SetBuilderDim oTuple As Tuple, strContext As String, oExp As Expression = New Expression
For Each oTuple In InputProductSet.Tuples strContext = GetCurrentContextFromTuple(oTuple) oExp.ExpressionText = "Var( " & InputTimeSet & ", " & SalesVolume & ")" oMDXVal = oExp.Calculate(oTuple) If oMDXVal.ToDecimal <= VarLowLimit Then oResSet.Add(oTuple) End IfNext oTuple
Return oResSet.ToSetEnd Function
The above code is working but does not return any rows. When I used the above procedure from the MDX query I tried to pass either Product Set as the InputProductSet or the crossjoint between the product set and the time set. Nothing worked. It returned no rows.
Please help.
Thanks.