Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
hello
i am looking to return the name of the product that has the highest unit proce.
product 1 , price 20
product 2 , price 10
product 3 , price 5
so i want to return the product name that has the max unit price = Product 1
how do i do this?
thanks!!
Amrita
Solved! Go to Solution.
Try something like this:
VAR MaxPrice =
MAX(Table[Price])
VAR ProductNames =
CALCULATE (
CONCATENATEX(
VALUES(Table[Product]),
Table[Product],
", " ),
Table[Price] = MaxPrice
)
RETURN ProductNames
i did the below and it worked - nice and simple!
i did the below and it worked - nice and simple!
In your test case that works fine. Just be aware that LOOKUPVALUE will return an error if more than one product has the same max price unless you specify an alternative result. @calerof solution will return BLANK in such cases. I included CONCATENATEX as it will return a list of all max prices.
Hi @AmritaOS ,
You could also use this code:
Highest Price =
CALCULATE(
SELECTEDVALUE(Table_20211202[Product Name]),
Table_20211202[Unit Price] = MAX(Table_20211202[Unit Price])
)
And get this result:
Hope it helps.
Regards,
Fernando
Try something like this:
VAR MaxPrice =
MAX(Table[Price])
VAR ProductNames =
CALCULATE (
CONCATENATEX(
VALUES(Table[Product]),
Table[Product],
", " ),
Table[Price] = MaxPrice
)
RETURN ProductNames
thank you yes this is definatelly way better and future proofs the measure!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
93 | |
86 | |
80 | |
69 | |
68 |
User | Count |
---|---|
226 | |
129 | |
119 | |
83 | |
77 |