ISINSCOPE Function (DAX)

How does the ISINSCOPE function (DAX) work?

ISINSCOPE function (DAX) returns true when the given column is the level within a level hierarchy.

ISINSCOPE Formula Syntax

ISINSCOPE (<columnName>)

How do you use the ISINSCOPE function?

It returns TRUE if the column is included in the filter context, and it is a grouping column in the result set for the current row.

Related Blog Posts

Related Support Forum Posts

Accessing Matrix hierarchy levels
Dynamic RANKX with Other Category
Developing Complex Dax functions

Considerations when using the ISINSCOPE function

When ISINSCOPE returns TRUE, then also HASONEVALUE returns TRUE.

Related Video Tutorials

Formula examples using the ISINSCOPE function

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]

Related DAX Functions

CALCULATE
HASONEVALUE
SUMMARIZECOLUMNS

Related Course Modules

Ultimate-Beginners-Guide-To-PowerBI

DOWNLOAD

To access our comprehensive DAX formula reference guide just insert your email address below. The resource will download immediately and we’ll also email it to you.