ISINSCOPE

適用対象:計算列計算テーブルメジャービジュアル計算

指定した列がレベルの階層においてそのレベルである場合は True を返します。

構文

ISINSCOPE(<columnName>)

パラメーター

用語 定義
columnName 標準 DAX 構文が使用された、既存の列の名前。 これを式にすることはできません。

戻り値

指定した列がレベルの階層においてそのレベルである場合は TRUE を返します。

解説

この関数は、計算列または行レベルのセキュリティ (RLS) ルールで使用される場合、DirectQuery モードでの使用はサポートされません。

DEFINE
MEASURE FactInternetSales[% of Parent] =
  SWITCH (TRUE(),
    ISINSCOPE(DimProduct[Subcategory]),
      DIVIDE(
        SUM(FactInternetSales[Sales Amount]),
        CALCULATE(
          SUM(FactInternetSales[Sales Amount]),
          ALLSELECTED(DimProduct[Subcategory]))
      ),
    ISINSCOPE(DimProduct[Category]),
      DIVIDE(
        SUM(FactInternetSales[Sales Amount]), 
        CALCULATE(
          SUM(FactInternetSales[Sales Amount]),
          ALLSELECTED(DimProduct[Category]))
      ),
    1
  ) * 100
EVALUATE
  SUMMARIZECOLUMNS
  (
    ROLLUPADDISSUBTOTAL
    (
      DimProduct[Category], "Category Subtotal",
      DimProduct[Subcategory], "Subcategory Subtotal"
    ),
    TREATAS(
      {"Bike Racks", "Bike Stands", "Mountain Bikes", "Road Bikes", "Touring Bikes"},
      DimProduct[Subcategory]),
    "Sales", SUM(FactInternetSales[Sales Amount]),
    "% of Parent", [% of Parent]
  )
  ORDER BY
    [Category Subtotal] DESC, [Category],
    [Subcategory Subtotal] DESC, [Subcategory]

次が返されます。

DimProduct[Category] DimProduct[SubCategory] [Category Subtotal] [Subcategory Subtotal] [Sales] [% of Parent]
true true 28,397,095.65 100.00
アクセサリ FALSE true 78,951.00 0.28
Accessories バイク ラック FALSE FALSE 39,360.00 49.85
アクセサリ バイク スタンド FALSE FALSE 39,591.00 50.15
バイク FALSE true 28,318,144.65 99.72
Bikes マウンテン バイク FALSE FALSE 9,952,759.56 35.15
バイク ロード バイク FALSE FALSE 14,520,584.04 51.28
バイク ツーリング バイク FALSE FALSE 3,844,801.05 13.58

SUMMARIZECOLUMNS 関数
CALCULATE 関数