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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
klajmexka
New Member

Filtering highest ID based on one unique number in direct query mode

Hello,

 

I'm stuggling with a solution how to filter only highest ID for each number in table. I managed to do it in offline DB however not able to make it work in direct query mode.

 

Let's say we have table like this:

nmb   ID

987498
9874102
987458
9874104
9874228
2511
2512
94188
94192

 

and I'd like to get this output:

nmb   ID

9874228
2512
94192

 

Thanks!

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @klajmexka ,

 

Please try to create a measure like this and apply it to visual level filter.

Measure 2 = 
var max_id = CALCULATE(MAX('Table'[ID]),ALLEXCEPT('Table','Table'[NMB]))
return IF(MAX('Table'[ID])=max_id,1,0)

V-lianl-msft_2-1611037375495.png

 

 

Best Regards,
Liang
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

5 REPLIES 5
V-lianl-msft
Community Support
Community Support

Hi @klajmexka ,

 

Please try to create a measure like this and apply it to visual level filter.

Measure 2 = 
var max_id = CALCULATE(MAX('Table'[ID]),ALLEXCEPT('Table','Table'[NMB]))
return IF(MAX('Table'[ID])=max_id,1,0)

V-lianl-msft_2-1611037375495.png

 

 

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

parry2k
Super User
Super User

@klajmexka you have to write another measure to get the note based on the highest Id.

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

any formula suggestion please?

parry2k
Super User
Super User

@klajmexka create a mesure and in the table visual use nmb and following measure

 

High =  MAX ( Table[Id] ) 

 

Check my latest blog post Year-2020, Pandemic, Power BI and Beyond to get a summary of my favourite Power BI feature releases in 2020

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

great, that is easier then I ever though 🙂 however I'd need one more thing. I'd like to add one additional column to this table which contains Notes, (string type) and only the Note with the highest ID should be visible. I thought it will do the job automatically when only nmb and highest ID is visible however it will show all IDs again. Don't you please know where could be the issue?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors