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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
wsilva_916
Regular Visitor

MAX value and corresponding name field in a visualization

I want to include a card or something similar in a dashboard to list the highest sales figure (i.e. MAX([sales] ), and also include the name of the related [salesperson].  I have a measure to calculate the max sales number, but I can't see any way to pull in another field from the same row.  Is this possible?  I'm open to using any type of visualization that will accomplish this. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Ok yes you could do this with a Table Visual.  Put in the FullName into the Values box.  You can also include the sales amount if you wish.

 

Under "Visual Level Filters", click on the FullName field and select the Filter Type "Top N".  Select 1 and place into the By Value box, the sum function.

View solution in original post

6 REPLIES 6
GANESH3400
Regular Visitor

I Have 24 income generated sources as columns, Man power, date. machine, tools. Now i wants to get row level dynamic maximun1, maximum2, Maximum 3  values with corresponding names. Red highlighted feilds required in power bI. 

 

NAMEDATETOOLSJOBSOURCE1SOURCE2SOURCE3SOURCE4SOURCE5SOURCE6SOURCE24MAX1MAX1 NAMEMAX2MAX2 NAME
XAVIOUR05-09-14DIE1500300200

400

755455800800SOURCE24755SOURCE5
ANDRES04-05-2020DIE2900450120640100899950950SOURCE24900SOURCE1
SONALI06-04-2021MAK

3

1000120480394134516010101601SOURCE61345SOURCE5
KANIL26-12-2018GEL4120130143165155164195195SOURCE24164SOURCE6
RAMSI21-02-2016MIN50121500160017213818491611849SOURCE61600SOURCE3

 

looking for solution... please respond if anyone have idea

Anonymous
Not applicable

Ok yep it can be done.  Here is a slice of code that can do it, and what you might need to tweak:

 

Max Value Name = var MaxValue = CALCULATE(MAX(TestData[Amount]), all(TestData))
RETURN 
CALCULATE(
    FIRSTNONBLANK(TestData[Name], TestData[Name]),
    TestData[Amount] = MaxValue
)


So this code assumes you don't want to filter your sales table during the visual, if you do replace the "ALL" with "ALLEXCEPT".

The variable at the top defines what the max value is.  The code below says to take the first non-blank in your data table where the amount is the same as your max value.  This will also break any ties when you have 2 records of the same amount that happen to be max.  It will simply give you the first of those should that occur.

Thank you very much for the answer, Ross.  It definitely works, but I'm realizing now I needed to include more detail in my original question.  I'm not actually trying to return a single row from the table.  Rather I want to locate the sales person with the highest aggregated sales over several months. 

 

So, I have the following fields in the data I'm importing:

[FullName] and [SalesAmount]

 

And I have created a measure as:

sumSalesAmount = SUM( [SalesAmount] )

 

Looks like the MAX function won't accept a measure, so I cannot simply replace the column references with a reference to the measure.  I do wish for the name of the sales person and the amount to dynamically adjust to a slicer I'll include in the dashboard for different sales teams.  Also, it's not a hard requirement but it would be very nice to return multiple names in the event of a tie. 

Anonymous
Not applicable

Ok yes you could do this with a Table Visual.  Put in the FullName into the Values box.  You can also include the sales amount if you wish.

 

Under "Visual Level Filters", click on the FullName field and select the Filter Type "Top N".  Select 1 and place into the By Value box, the sum function.

Perfect! Thank you!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors