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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
VISRAI
New Member

2nd Highest Value

There are 3 columns in table, company, model and sale. There are 2 company name and different models for them, how can i get the 2nd highest sale model. I want the model name which have the 2nd highest sale in both company.

1 ACCEPTED SOLUTION

i have created a measure Rank = RANKX(ALLEXCEPT('Table','Table'[Class Name]),CALCULATE(SUM([EPI CNV 100]),ALLEXCEPT('Table','Table'[Class Name],'Table'[Insured Name])),,DESC,Dense) then used this one in the filter to get only 2nd highest value

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @VISRAI ,

Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.

If these also don't help, please share more detailed information and description to help us clarify your scenario to test.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

i have created a measure Rank = RANKX(ALLEXCEPT('Table','Table'[Class Name]),CALCULATE(SUM([EPI CNV 100]),ALLEXCEPT('Table','Table'[Class Name],'Table'[Insured Name])),,DESC,Dense) then used this one in the filter to get only 2nd highest value

Greg_Deckler
Super User
Super User

@VISRAI Should be something along the lines of:

Measure = 
  VAR __Table = SUMMARIZE( 'Table', [model], "__Value", MAX('Table'[sale]) )
  VAR __MaxSale = MAXX( __Table, [__Value] )
  VAR __2ndMaxSale = MAXX( FILTER( __Table, [__Value] <> __MaxSale ), [__Value] )
  VAR __Result = MAXX( FILTER( __Table, [__Value] = __2ndMaxSale ), [model] )
RETURN
  __Result


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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors