Search code examples
c#ssasmdx

How to Implement IN operator in MDX


I want to get data from cube based on passed number of customer ids through Web API (C#). As i have search there is no clue to fetch data using IN operator like IN in T-Sql but how can we do in MDX query?. I can filter with single value using instr.

would you provide any suggestion how to perform this? May i do for loop and query for single value, store and return, but it will be heavy query or every Single value?


Solution

  • In operator can be implement in MDX quite easily. Let say I want to list data for 2011,2012, 2013 . The implementaion will be as follows.

    {[Date].[Calendar Year].[CY 2011],[Date].[Calendar Year].[CY 2012],[Date].[Calendar Year].[CY 2013]}

    Here the brackets indicate that there is a set referred"{}".

    Based on the last comment. So lets say you get three id 100,200,300 and you want to have implement IN them.

    {[Customers].[Customer].[100],[Customers].[Customer].[200],[Customers].[Customer].[300]}