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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
thebaguette
New Member

Get dimension value based on minimum metric value

Hi,

 

I have the following table :

 

EANStorePriceDate
AAAAAAmazon10001/01/2022
AAAAAEbay12001/01/2022
AAAAAAmazon11008/01/2022
AAAAAEbay13008/01/2022
AAAAAAli10508/01/2022
CCCCCAmazon1001/01/2022
CCCCCEbay1201/01/2022
CCCCCAmazon1008/01/2022
CCCCCAli1108/01/2022

 

EAN is the reference of a product selled by Amazon, Ali... I have the product price updated every week. I need to know, for a disctinct product, what is the store selling the product at the cheapest price.

 For example, if the date filter is all January, the results should be:

 

EANCheapest_store
AAAAAAli
CCCCCAmazon

As you can see, only the last updated date should be taken into account (if there is data).

 

I would like also to be able to count the number of time each store has been the cheapest one (based on last date as well):

StoreCount_cheapest
Ali1
Amazon1
Ebay0

 

I tried the following dax formula but it does not give the expected results:

'''

var maxDate = CALCULATE(MAX(full_pricing_stores[date]))
var min_Price = [min_price_concurrents]


RETURN
CALCULATE (
COUNTROWS (full_pricing_stores),
FILTER( full_pricing_stores, full_pricing_stores[date] = maxDate && full_pricing_stores[price] = min_Price),
ALLEXCEPT(full_pricing_stores, full_pricing_stores[store] )
)​

 '''

Any helpd & advice would be greatly appreciated 🙂

 

Thank you

2 REPLIES 2
amitchandak
Super User
Super User

@thebaguette , Try a measure like

Rankx(Filter(allselected(Table[EAN], Table[Month Year], Table[Store]), [EAN] = Max([EAN]) && [Month Year] = max([Month Year])), calculate(Min(Table[Price])),,asc,dense)

 

you can use visual level filter of 1

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak,

 

Thank you for your answer. Unfortunately it didn't work. I did some calculation before connecting the table to PBI to make it work 🙂

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.