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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
MikhailGG
Helper I
Helper I

Using values to compare from 2 tables in DAX Filter

How to use 2 different tables in filter expression?

 

CALCULATE (VALUES ( 'Benchmark Categories'[Categories]), Table[Value]>='Benchmark Categories'[Lower_Level], Table[Value]<'Benchmark Categories'[Upper_Level])
doesn't work.
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @MikhailGG ,

Here is my sample data:

vjunyantmsft_0-1729822807416.png

vjunyantmsft_1-1729822816321.png

 

vjunyantmsft_2-1729822823942.png

You can use this DAX to create a calculated table in table Benchmark Categories

Dog_ID_Count = 
CALCULATE(
    COUNTROWS('Table'),
    FILTER(
        'Table',
        'Table'[Value] >= 'Benchmark Categories'[Lower_Level] &&
        'Table'[Value] <= 'Benchmark Categories'[Upper_Level]
    )
)

And the final output is as below:

vjunyantmsft_3-1729822888483.png

vjunyantmsft_4-1729822905085.png

 

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
FreemanZ
Super User
Super User

hi @MikhailGG ,

 

how are Benchmark Categories and 'table' related?

Hi @FreemanZ 

 

There is no relationship between the tables. Benchmark Categories is customly created.

hi @MikhailGG ,

 

what filter context do you have for the needed measure? Or how do you plan to visualise the measure?

I have multiple categories in Benchmark Categories table,

CategoryLower_LevelUpper_Level
0-10010
11-201120
21-302130

 

I want to create a measure that I would use to visualize count of dogs within those ranges. Y-axis is the measure. X-axis is the Count of Occurences. Table[Values] is the value that corresponds to each dog individualy, e.g. it's height in inches.

 

MikhailGG_0-1729803063493.png

The chart's output is that 819 dogs are of the height between 0 and 10. 227 dogs are of the height between 11 and 20, and so on.

Anonymous
Not applicable

Hi @MikhailGG ,

Here is my sample data:

vjunyantmsft_0-1729822807416.png

vjunyantmsft_1-1729822816321.png

 

vjunyantmsft_2-1729822823942.png

You can use this DAX to create a calculated table in table Benchmark Categories

Dog_ID_Count = 
CALCULATE(
    COUNTROWS('Table'),
    FILTER(
        'Table',
        'Table'[Value] >= 'Benchmark Categories'[Lower_Level] &&
        'Table'[Value] <= 'Benchmark Categories'[Upper_Level]
    )
)

And the final output is as below:

vjunyantmsft_3-1729822888483.png

vjunyantmsft_4-1729822905085.png

 

Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

I have solved a similar question in the attached files.

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors