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
Anonymous
Not applicable

Filter a table by highest column value

Hello!

 

I have a dataset that is looking something like this:

 

ServerScanid
Server11
Server22
Server3

1

Server1

3

Server2

3

How can I make a DAX query the only filters out the servers in the last Scanid?

 

In this example I would like to return:

ServerScanid
Server13
Server23
2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below, whether it is what you are looking for.

 

Picture2.png

 

ScanID Measure =
VAR lastscanidoverall =
MAXX ( ALL ( 'Table' ), 'Table'[Scanid] )
VAR currentscanid =
MAX ( 'Table'[Scanid] )
RETURN
IF (
ISFILTERED ( 'Table'[Server] ),
IF ( lastscanidoverall = currentscanid, currentscanid )
)

 

 

https://www.dropbox.com/s/093gm8gkoidowoq/anthon.pbix?dl=0 

 

 

Hi, My name is Jihwan Kim.

 

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

 

Linkedin: linkedin.com/in/jihwankim1975/

Twitter: twitter.com/Jihwan_JHKIM


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.
Greg_Deckler
Community Champion
Community Champion

@Anonymous I call this the Complex Selector. https://community.powerbi.com/t5/Quick-Measures-Gallery/The-Complex-Selector/td-p/1116633

 

Basically, create a measure like the following and use it in the Filter pane or you could also do it as a column:

Measure Selector =
  VAR __Max = MAXX(ALL('Table'),[ScanID])
  VAR __Current = MAX('Table'[ScanID])
RETURN
  IF(__Current = __Max,1,0)


Column Selector
  VAR __Max = MAX('Table'[ScanID])
  VAR __Current = [ScanID]
RETURN
  IF(__Current = __Max,1,0)

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

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 community update carousel

Fabric Community Update - June 2025

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