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
roncruiser
Post Patron
Post Patron

Min and Max from Column 1 based on range defined by Column2

Hello, 

The max values from Column2 define the range of values I need from Column1.
For example, 5 is the max value from Column2.
The max value from Column1 = 6
The min value from Column1 = 2

How do I retreive the values 6 and 2 from Column1 based on range defined by the Max values in Column2?

Ultimately I want the difference: 6-2 = 4 

Thank you...

 

Column1Column2
91
82
73
65
55
45
35
25
12
1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @roncruiser 

I assume you will be using a card visual you may try. 

Measure1 =
VAR Column2Max =
    MAX ( 'Table'[Column2] )
VAR MaxVakueTable =
    FILTER ( 'Table', 'Table'[Column2] = Column2Max )
VAR Column1Max =
    MAXX ( MaxVakueTable, 'Table'[Column1] )
VAR Column1Min =
    MINX ( MaxVakueTable, 'Table'[Column1] )
RETURN
    Column1Max - Column1Min

View solution in original post

3 REPLIES 3
roncruiser
Post Patron
Post Patron

@tamerj1 
The solution worked well.  It sent me in the right direction for finding my own solution using your example as a base.
Thanks!

v-yanjiang-msft
Community Support
Community Support

Hi @roncruiser ,

Has your problem solved by @tamerj1 's solution? If yes, please consider accept it as the solution to help the other members find it more quickly.

Best Regards,
Community Support Team _ kalyj

tamerj1
Super User
Super User

Hi @roncruiser 

I assume you will be using a card visual you may try. 

Measure1 =
VAR Column2Max =
    MAX ( 'Table'[Column2] )
VAR MaxVakueTable =
    FILTER ( 'Table', 'Table'[Column2] = Column2Max )
VAR Column1Max =
    MAXX ( MaxVakueTable, 'Table'[Column1] )
VAR Column1Min =
    MINX ( MaxVakueTable, 'Table'[Column1] )
RETURN
    Column1Max - Column1Min

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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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