Forum Discussion

voidbydefault's avatar
2 years ago

Filter a matrix based on selected value in another matrix

Hi,

 

Requirement:
I have a table called [data_tickers], amongst other columns, it has columns called  [company] and [industry] and presented in a matrix (let's call it matrix 1). I want to show all peer companies in matrix 2 based on the [industry] of selected value (i.e. company) in martrix 1. For example:

 

Company | Industry

A | IT

B | Food processing

C | IT

... etc.

 

If company B is selected then matrix 2 should show all companies from the group "food processing".

 

Note:

My requirement is different than using slicers to filter both matrices. I want to filter matrix 2 results based on selected value in matrix 1.

 

I have tried using:

 

 

 

 

 

VAR selected_industry = SELECTEDVALUE(data_tickers[industry])
RETURN

CALCULATE(
   SUMMARIZE(data_tickers, data_tickers[industry]),
   FILTER(data_tickers,data_tickers[industry] = selected_industry)
)

 

 

 

 

 

 

Also tried this:

 

 

 

 

 

VAR selected_industry = SELECTEDVALUE(data_tickers[industry])
RETURN

CALCULATETABLE(
   FILTER(
      ALL(data_tickers),
   data_tickers[industry] = selected_industr)),
data_tickers[shortName]
)

 

 

 

 

And a few other similar things, but all attempts are failing for one or other reason.

 

Any ideas?

 

Thanks.

 

12 Replies