ISINSCOPE
當指定的資料行為多層階層中層級時,則會傳回 Ture。
語法
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 | |
配件 | Bike Racks | FALSE | FALSE | 39,360.00 | 49.85 |
配件 | Bike Stands | FALSE | FALSE | 39,591.00 | 50.15 |
Bikes | FALSE | TRUE | 28,318,144.65 | 99.72 | |
Bikes | Mountain Bikes | FALSE | FALSE | 9,952,759.56 | 35.15 |
Bikes | 公路車 | FALSE | FALSE | 14,520,584.04 | 51.28 |
Bikes | 休閒車 | FALSE | FALSE | 3,844,801.05 | 13.58 |