cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SriKandimalla
Helper I
Helper I

How to use DAX to filter values from a slicer range (min and max) from an unrelated table

Hello Power BI Community,

I am working on a difficult situation (atleast for me) with a scatter plot because I need to use Unsummarized values. I have 2 tables and there is no relation between them. However, the Table1 has more data fields and all my slicers are setup based on Table1. So, naturally when a slicer is selected, it does nothing. I have one common field in both the tables, but not relatable completely. What I am trying to acheive is that if 'Table1'[common field] is sliced. I want to take that range (max & min) and want to limit the 'Table2'[common field] values that go into the scatter plot. There is a measure I created and I want to filter that measure so the plot values change indirectly.

Example tables:
TABLE 1

NameColorCommon field
ARED2
ABLUE25
BRED100
BBLUE200
BYELLOW250
CRED400
CBLUE700
CYELLOW850
CGREEN1000

 

TABLE 2

Common FieldValue
10$187543.86
100$150697.34
150$151499.66
200$143996.73
500$176483.52
520$106947.30
600$156962.43
650$199146.77
680$185979.72
700$172273.33

 

So, from the above data, I put a slicer for 'Table1'[common field], and I grabbed those min and max values in 2 measures (let's call them Min & Max) so that they are dynamic.
for example: If the slicer value is selected between 200 - 700, then my scatter plot values should be limited to $143996.73 -  $172273.33

Now what I want to do is 
CALCULATE(VALUES('Table2'[Value]),FILTER('Table2','Table2[common field]>=Min && 'Table2'[common field]<=Max))

This clearly did not help me. Also I tried TREATAS() and CONTAINS().

I would really appreciate any help on this one. 

TIA,
Sri
@amitchandak , 

1 ACCEPTED SOLUTION
stevedep
Memorable Member
Memorable Member

Hi,

Not sure if this is what you are looking for?

 

___Test =  CALCULATE(SUM(Table2[Value]), FILTER(Table2, [Common Field] >= MIN(Table1[Common field]) && [Common Field] <= MAX(Table1[Common field])))

 

filter.png

Link to  file
Kind regards, Steve.  

View solution in original post

2 REPLIES 2
stevedep
Memorable Member
Memorable Member

Hi,

Not sure if this is what you are looking for?

 

___Test =  CALCULATE(SUM(Table2[Value]), FILTER(Table2, [Common Field] >= MIN(Table1[Common field]) && [Common Field] <= MAX(Table1[Common field])))

 

filter.png

Link to  file
Kind regards, Steve.  

@stevedep 

Thank you for the solve. Really appreciate the help.

Helpful resources

Announcements
Winner of T-Shirt Design

Power BI T-Shirt Design Challenge 2023

Find out who won the T-Shirt Design Challenge and the top 3 finalists.

March 2023 Update3

Power BI March 2023 Update

Find out more about the March 2023 update.