I am creating a measure in SSAS. It defines in the CASE construction whether to show a value or not (values ​​are shown only for sheet and non-zero elements). All is painted for measurement of the Nomenclature. Everything works well. But this measure can still be displayed in the context of other dimensions, for example, Counterparties. If you simply add more WHEN conditions in the CASE construction, then only the Nomenclature works. It was also tried to add the second to the first conditions with the help of OR - then it works not quite rightly and only when, in the context of both Nomenclature and Counterparties. It does not occur to me how to implement everything correctly.

Here is the code for creating the measure:

CREATE MEMBER CURRENTCUBE.[Measures].[Цена с завода шт] AS CASE WHEN IsLeaf([Номенклатура].[Номенклатура]) THEN [Measures].[Цена с завода шт расч] WHEN [Номенклатура].[Номенклатура].level.ordinal = 0 OR IsEmpty(([Номенклатура].[Номенклатура], [Measures].[Сумма с завода])) THEN NULL --WHEN IsLeaf([Контрагенты].[Контрагенты]) THEN [Measures].[Цена с завода шт расч] --WHEN [Контрагенты].[Контрагенты].level.ordinal = 0 OR --IsEmpty(([Контрагенты].[Контрагенты], [Measures].[Сумма с завода])) THEN NULL ELSE '' END, 

    1 answer 1

    Maybe, still SCOPE, in your example something like this

     CREATE MEMBER CURRENTCUBE.[Measures].[Цена с завода шт] AS NULL; SCOPE ([Measures].[Цена с завода шт]) SCOPE (DESCENDANTS([Номенклатура].[Номенклатура].[All],,LEAVES)) THIS = [Measures].[Цена с завода шт расч] END SCOPE; SCOPE (DESCENDANTS([Контрагенты].[Контрагенты].[All],,LEAVES)) THIS = [Measures].[Цена с завода шт расч] END SCOPE; END SCOPE; 

    Meaning - the measure [Measures].[Цена с завода шт расч] will be displayed [Measures].[Цена с завода шт расч] when there is an analysis of the leaf elements of the Nomenclature or Counterparty . In other cases, NULL.