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

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

Reply
Manohar_Sathya
Regular Visitor

Filtering distinct values in a column w.r.t max value in the next column

Hi All,

I want to filter distinct values in ID Column which has MAX value in Version column. Any Suggestions would help me a lot.

ID     Version
1001    1
1001   2
1001    5
1005   1
1008   2
1005   2
1003   2
1004   1
1003   1
1006   1
1008   1
1001   3
1001   4

 

Thanks 

MANOHAR

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @Manohar_Sathya ,

 

Try this:

Max Value Column 1 = 
CALCULATE ( MAX ( 'Table'[Version] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
Max Value Column 2 = 
CALCULATE (
    MAX ( 'Table'[Version] ),
    FILTER ( 'Table', 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
)
Max Value Measure 1 = 
CALCULATE ( MAX ( 'Table'[Version] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
Max Value Measure 2 = 
IF (
    ISFILTERED ( 'Table'[ID] ),
    CALCULATE (
        MAX ( 'Table'[Version] ),
        FILTER ( 'Table', 'Table'[ID] = MAX ( 'Table'[ID] ) )
    ),
    MAX ( 'Table'[Version] )
)

measures.JPGcolumns.JPG

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

View solution in original post

5 REPLIES 5
Icey
Community Support
Community Support

Hi @Manohar_Sathya ,

 

Try this:

Max Value Column 1 = 
CALCULATE ( MAX ( 'Table'[Version] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
Max Value Column 2 = 
CALCULATE (
    MAX ( 'Table'[Version] ),
    FILTER ( 'Table', 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
)
Max Value Measure 1 = 
CALCULATE ( MAX ( 'Table'[Version] ), ALLEXCEPT ( 'Table', 'Table'[ID] ) )
Max Value Measure 2 = 
IF (
    ISFILTERED ( 'Table'[ID] ),
    CALCULATE (
        MAX ( 'Table'[Version] ),
        FILTER ( 'Table', 'Table'[ID] = MAX ( 'Table'[ID] ) )
    ),
    MAX ( 'Table'[Version] )
)

measures.JPGcolumns.JPG

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

Manohar_Sathya
Regular Visitor

It is accepted even as a table which looks like the below one;

ID Version
1001 5
1005 2
1008 2
1004 1
1003 2
1006 1

Manohar_Sathya
Regular Visitor

Even an additional Column or a measure would work for me.

Fowmy
Super User
Super User

@Manohar_Sathya 

 

Can you show me the expected results based on your sample data?

 

Do you need a table as an output or a measure?

 

________________________

If my answer was helpful, please click Accept it as the solution to help other members find it useful

Click on the Thumbs-Up icon if you like this reply 🙂


Website YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

ID Version
1001 5
1001 5
1001 5
1005 2
1008 2
1005 2
1003 2
1004 1
1003 2
1006 1
1008 2
1001 5
1001 5

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.