Here is another example of getting the top N and showing the percentage of the total using the HoleFoods cube in SAMPLES.

To get the top N with Analyzer, you need to both sort the values in descending order and specify the value for N.

First I added Outlet.H1.Country to the Rows box,

Then I clicked the gear icon to the right of "Country" in Rows box, which invokes the Level Options dialog.

The highlighted red box shows the sorting by descending Revenue and returning the first N members.

These settings combined will show you the top 10 countries by Revenue.

There are several ways to get the percentage of the total with a calculated member (measure).

Evgeny's answer is one way.

Here is different expression that uses %ALL:

Measures.[Amount Sold]/(Measures.[Amount Sold],[Outlet].[All Outlet].%ALL)

Another expression that uses %MDX to get the same result:

Measures.[Amount Sold]/%MDX("select Measures.[Amount Sold]on 1 from HOLEFOODS","%CONTEXT","filters|columns")

Here is the calculated member dialog in Analyzer using the first expression.

Here is the result:

In 2016.1, we added several methods to %DeepSee.Utils to get and execute MDX from a pivot table:

  •  %GetMDXFromPivot(): returns MDX text for a pivot table. Optionally executes the query.
  •  %ExecutePivot(): executes the MDX for a pivot table. Optionally returns the associated %DeepSee.ResultSet.
  •  %GetResultSetFromPivot(): returns the %DeepSee.ResultSet for a pivot table.  Optionally executes the query.

For details, see the class reference for %DeepSee.Utils.

You should use %ExecuteAsynch.

The %ExecuteAsynch method uses multiple DeepSee agents do to the work.

The %Execute method only uses only 1 process (the current process) to do all the work. This is why %Execute is slower than you saw with Analyer, which uses %ExecuteAsynch.

So change your code to this:

Set tSC = oMDX.%ExecuteAsynch(,,1)

Here is the method signature of %ExecuteAsync

method %ExecuteAsynch(Output pQueryKey As %String,
                      ByRef pParms,
                      pWait As %Boolean = 0) as %Status

The 3rd argument of 1 indicates that you want to wait until the query is completed before the method completes.

If you don't wait until the query is  complete (pWait = 0), then your code can proceeed without waiting for the query to complete.  Then you can later use the instance method %GetStatus or the classmethod %GetQueryStatus to check if the query is complete.

Please define what you are trying to achieve by having the same dashboard available in multiple namespaces.

Do you want the same dashboard definiton using the same pivot table and KPIs defintions, accessing the same cube defintions? And each namespace has the same cube name but different data because the source class has different data in each namepace?

If this is what you are trying to achieve, the best way to do this is to export the dashboard and related pivots, KPIs, etc. and then import them into each namespace.