March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi all,
I got stucked with a following issue. I'm having a table with products, costs, prices and margins. I would like to vlookup product code with the highest margin value.
When there is just one highest margin value in a table, there is no issue. The problem appears when there are a few products with the same highest margin value.
The sample table looks as below:
CODE | COST | PRICE | MARGIN |
12345 | 2 | 4 | 0.5 |
12346 | 7 | 14 | 0.5 |
12347 | 6 | 12 | 0.5 |
12348 | 12 | 19 | 0.37 |
12349 | 10 | 7 | -0.43 |
The formula:
CODE_HIGHEST_VALUE =
Solved! Go to Solution.
Thanks, guys, but your formulas are not working as I wished. But I have found the solution:
MaxCodes =
VAR MaxMargin =
MAXX(SampleTable,SampleTable[MARGIN]
)
RETURN
CONCATENATEX(
FILTER(
ALLSELECTED(SampleTable),
SampleTable[MARGIN] = MaxMargin
),
SampleTable[CODE],
","
)
Thanks, guys, but your formulas are not working as I wished. But I have found the solution:
MaxCodes =
VAR MaxMargin =
MAXX(SampleTable,SampleTable[MARGIN]
)
RETURN
CONCATENATEX(
FILTER(
ALLSELECTED(SampleTable),
SampleTable[MARGIN] = MaxMargin
),
SampleTable[CODE],
","
)
@Mardob , You can have measures
MARGIN p = Sum(Table[MARGIN])
TOP 1= calculate(Max(Table[CODE]), keepfilters( index(1, allselected(Table[CODE]), orderBy([MARGIN p], desc))) )
Plot this with Table code in visual
Or a measure like
CONCATANATEX(index(1, allselected(Table[CODE]), orderBy([MARGIN p], desc)), Table[CODE], ", ")
Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
146 | |
97 | |
79 | |
69 |