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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Frenchtom811
Resolver I
Resolver I

Return a category name associated with a minimum value

So I have some simple data, please see the below example:

 

Date   Seller Name   Item Number   Price
Oct 26  Jill123ABC10
Oct 26  Bob123ABC9
Oct 26  Jill 456DEF20
Oct 26  Joe456DEF20
Oct 27  Bob123ABC9
Oct 27  Jill123ABC

10

Oct 27  Joe456DEF19
Oct 27Bob456DEF

18

 

I want to return the Seller name associated with the lowest Price for each combination of Item Number and Date in a stacked column chart or in a table.  I have a slicer on my dashboard for the Item Number so only one Item Number can be selected at a time.  My chart or table will use the date for each column.  Please see the below example bar chart. 

 

Frenchtom811_0-1635442151972.png

This seems so simple.  The date is segregated by the chart's x-axis and the item number is isolated by the slicer but I cannot figure out how to return the SellerName associated with the lowest price for each date/item number combo.

   

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@Frenchtom811 Seems like a variation on lookup min/max like:

Measure =
  VAR __Table = SUMMARIZE('Table',[Date],[Seller Name],[Item Number],"__Price",MIN([Price])
  VAR __Min = MINX(__Table,[__Price])
RETURN
  MAXX(FITLER(__Table,[__Price]=__Min),[Seller Name])

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

@Frenchtom811 Use CONCATENATEX instead of MAXX


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@Frenchtom811 Seems like a variation on lookup min/max like:

Measure =
  VAR __Table = SUMMARIZE('Table',[Date],[Seller Name],[Item Number],"__Price",MIN([Price])
  VAR __Min = MINX(__Table,[__Price])
RETURN
  MAXX(FITLER(__Table,[__Price]=__Min),[Seller Name])

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hello @Greg_Deckler and thanks for your response.  I got your calculation to work in a table which is good enough for me.  Do you know how I can return the names of multiple sellers when they have the same minimum price?  Referring to my above example on 26 Oct for item number 456DEF, I want to display Joe and Jill.  Right now, the measure displays Joe or Jill.  Thanks!

@Frenchtom811 Use CONCATENATEX instead of MAXX


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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