Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
crln-blue
Post Patron
Post Patron

ISINSCOPE & SELECTEDVALUE for 2-level hierarchies (2 columns)

Hello!

 

I made a fact table (summarized) using DAX with the ff columns:

CategoriesItem IDParent IDDatesAmountPathLevel 1Level 2
A1  355A 
B2  6782B 
C32 574573 | 2BC
D42 45754 | 2BD
E5  4585E 
F6  367346F 
G76 3647 | 6FG
H8  4648H 

 

Now, I created a single measure for all of the computations of the categories.
I used SELECTEDVALUE on a SWITCH statement:

Measure = SWITCH(SELECTEDVALUE(Level 2), get the each child values

My concern is, how about the parents' values? My parent categories has a different formulas for each (not sum, more on subtracting). For example

A = F - B

H = E - F

 

But upon searching I stumbled upon ISINSCOPE where the calculations will be computed per column level. (Use IsInScope to get the right hierarchy level in DAX - Kasper On BI)

Is there a way to use SELECTEDVALUE for two columns in a single measure? 
Or for ISINSCOPE, can I filted the column for each value? For example:
ISINSCOPE(level2) = A

(Not sure if I should post it here or on Desktop category)

 

Edited: sorry for the confusion. My current problem was SELECTEDVALUE but I was also thinking about using ISINSCOPE and how would I do it. Thanks again 

6 REPLIES 6
PaulDBrown
Community Champion
Community Champion

@crln-blue 

Apologies again, but I am still struggling to understand what the final output should be. Could you mockup up a sample in Excel showing the original table, the calculation and the final output expected?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hello @PaulDBrown ! I apologize for the confusion. Here's my sample file from Github.

Below is my data:

crln-blue_0-1608234232216.png

 

My visual:

crln-blue_1-1608234285080.png

I don;t know the right approach of this. I have parent categories where its formula is a subtraction formula. But SELECTEDVALUE only adds up using the SUM function or SUMX.

Thanks for the help!

@crln-blue 

 

Thanks for the sample PBIX. It makes things much easier.

 

See if this is what you need:
Matrix.JPG

 

I've attached the PBIX file for you





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hello @PaulDBrown ! Thank you very much!
I'm currently checking it now and currently studying it (will get back to you for more questions).

Anyhow, I'm curious to this:

crln-blue_0-1608298691461.png

 

In the Model View, it seems like a table:

crln-blue_1-1608298717242.png

But its logo under the Fields menu of the Data View is not a table. It's my first time seeing this (still a bit new to PowerBI). What does it call and how do you do it?

 

Thanks again for all the help!

PaulDBrown
Community Champion
Community Champion

@crln-blue 

 

Hi there. Apologies since I'm slightly confused as to what the final outcome should be. Can you post an example of the visual you wish to create including this new measure ?





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Hello @PaulDBrown ,

Thanks for the question, I read it again and you're right. It's quiet confusing. I edited my post. My real concerns are the ff: using ISINSCOPE but the column is filtered and using SELECTEDVALUE in two tables.

 

Based on my research, seems like ISINSCOPE is the best way but another problem will arise if I segregate my data levels into many level columns - sorting of my hierarchy (a bit off topic). So I was hoping if I can use ISINSCOPE but the column is filtered to a value I desire (for computation purposes).

 

Currently, I'm also checking SELECTEDVALUE but when I add on the formulas, it doesn't seem to do so that's why it's blank on the matrix.

 

Here's a sample visual:

crln-blue_0-1608142656574.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.