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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Yossi16
Regular Visitor

SELECTEDVALUE Question

Hello,

Is it possible to return a table with the filter of the SELECTEDVALUE function? I tried to do it with a calculated table, but it won't let me. Additionally, I attempted to use a measure, but I encountered a scalar error that prevented me from achieving the desired result.

What would you suggest as my best option?

 

Something like that... 

Peers_industry = FILTER( DWH_Lookup_Companies, DWH_Lookup_Companies[Industry] = SELECTEDVALUE(DWH_Lookup_Companies[Industry]) )

 

Thanks..

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Yossi16 

I guess what you want to achieve is when you select either Roni or Sami the table will be filtered down to only both rows because they both share the same School. 
There are a number of methods to accomplish this however none of them can be a calculated table as calculated tables/columns do not interact with the filter context. Therefore, I would suggest to simply have a disconnected table of the names. The you can create a filter measure that you can place in the filter pane of the table visual and  select "is" 1 then apply the filter

FilterMeasure =
INT (
SELECTEDVALUE ( 'Table'[School] )
IN CALCULATETABLE (
VALUES ( 'Table'[Scoop] ),
'Table'[Name] IN VALUES ( Names[Name] ),
ALLSELECTED ()
)
)

View solution in original post

5 REPLIES 5
tamerj1
Super User
Super User

Hi @Yossi16 

I guess what you want to achieve is when you select either Roni or Sami the table will be filtered down to only both rows because they both share the same School. 
There are a number of methods to accomplish this however none of them can be a calculated table as calculated tables/columns do not interact with the filter context. Therefore, I would suggest to simply have a disconnected table of the names. The you can create a filter measure that you can place in the filter pane of the table visual and  select "is" 1 then apply the filter

FilterMeasure =
INT (
SELECTEDVALUE ( 'Table'[School] )
IN CALCULATETABLE (
VALUES ( 'Table'[Scoop] ),
'Table'[Name] IN VALUES ( Names[Name] ),
ALLSELECTED ()
)
)

Great! Thank you.

MattAllington
Community Champion
Community Champion

It's not clear what you are trying to do. Is peers_industry supposed to be a measure, a calc colum, or a new table?  The DAX you have written is a table function, so it can only be used by creating a "new table". Measures and columns must return scalar values, not tables. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Alright, I will try to explain myself better:

I have a slicer that selects a specific value from a table. My goal is to retrieve another value from the same row as the selected value and use it as a filter in a Matrix visual. This way, the Matrix will display a table with only the data that matches this specific filter.

For example, if the selected value in the table is "Dan," I want to filter the Matrix to display only data related to "UCLA."

I hope this clarification helps. 

Yossi16_0-1686465685482.png

 

 

Thank you

It sounds like you do not have a dimensional model. I could be wrong. Read my article here. https://exceleratorbi.com.au/the-optimal-shape-for-power-pivot-data/

if you have a dimensional model, this type of filtering behaviour happens automatically. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
I will not give you bad advice, even if you unknowingly ask for it.

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors