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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
michaelskj8
Regular Visitor

Get highest value per group

Hi all. Hope you are able to help me.

 

I have read a similar post about filtering on the highest value per group, but this unfortunately does not solve my issue. Here goes.:

 

I have a data table like the one below. I need to find the file related to the newest year, and get all years associated with that file filtered so they are the only ones left in the data table.

 

File name         Customer number       Year

A                      1000                             2012

A                      1000                             2013

A                      1000                             2014

B                      1000                             2012

B                      1000                             2013

B                      1000                             2014

B                      1000                             2015

 

In this case, file "B" is the one i want all the rows for, since 2015 is the newest year. I.e. wanted result is:

B                      1000                             2012

B                      1000                             2013

B                      1000                             2014

B                      1000                             2015

 

 

How do I do this?

 

PS: I have many thousand rows

 

BR Michael

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

I'm thinking:

 

Customer = 
VAR __max = MAXX('Table',[Year])
VAR __filemax = MAXX(FILTER('Table',[Year]=__max),[File name])
VAR __table = FILTER('Table',[File name]=__filemax)
RETURN
__table


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...

Do I create a new table or column?

Will give it a shot and come back 🙂

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.