Forum Discussion
Nadim1313
2 years agoNew Member
ISINSCOPE in a Matrix Hierarchy
Hi,
I was trying to test if I can rank rows based on their hierarchy level group using the isinscope function in a switch statement.
Initially I tested the following:
Test is in scope =
SWITCH(
TRUE(),
ISINSCOPE(DimProductCategory[ProductCategoryName]),
1,
ISINSCOPE(DimProductSubcategory[ProductSubcategoryName]),
2
)
However the Matrix is returning 1 for every level, whereas I expected a 2 in the subcategory level.
Any idea what the issue could be?
I also tried it using a date table so that I am basing the query on a single table using year and quarter, but also no success.
Thanks in advance!
Hello Nadim1313 ,
you should in reverse order. So if level one is above in a visual and level 2 is below, then use Level2, level 1
Test is in scope = SWITCH( TRUE(), ISINSCOPE(DimProductSubcategory[ProductSubcategoryName]), 2, ISINSCOPE(DimProductCategory[ProductCategoryName]), 1 )
2 Replies
- Idrissshatila
Super User
Hello Nadim1313 ,
you should in reverse order. So if level one is above in a visual and level 2 is below, then use Level2, level 1
Test is in scope = SWITCH( TRUE(), ISINSCOPE(DimProductSubcategory[ProductSubcategoryName]), 2, ISINSCOPE(DimProductCategory[ProductCategoryName]), 1 ) - Nadim1313New Member
Great thanks! Works perfectly now