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
jerryr125
Helper III
Helper III

displaying a description in a measure based upon another variable

Hi - 

I would like to create a measure that displays a description based upon the maximum amount of a variable.

As an example of values in a data table:

 

FlavorAmount
Vanilla20000
Chocolate35000
Cookies and Cream15000

 

I would like to display Flavor which has the maximum amount.

Therefore the value of the Measure would be "Chocolate" given that is the flavor with the maximum Amount (35000).

 

Any thoughts would be appreciated - Jerry

1 ACCEPTED SOLUTION
v-pnaroju-msft
Community Support
Community Support

Thank you, @Deku , for your response.


Hi @jerryr125,

We appreciate your query posted on the Microsoft Fabric Community Forum.

In addition to the response provided by @Deku , please find below the DAX measure which may help resolve the issue:

FlavorWithMaxAmount =

CALCULATE(

SELECTEDVALUE('Table'[Flavor]),

FILTER(

'Table',

'Table'[Amount] = MAX('Table'[Amount])

)

)

If you find our response helpful, we kindly request you to mark it as the accepted solution and consider giving kudos. This will assist other community members who may have similar queries.

Thank you.

View solution in original post

4 REPLIES 4
v-pnaroju-msft
Community Support
Community Support

Hi @jerryr125,

Thank you for your follow-up.
Kindly find below the revised DAX measure, which may help in resolving the issue:

LocationWithMostVanillaOrStrawberry =

VAR FilteredTable =

FILTER(

'Flavors-Sold-Data-Table',

'Flavors-Sold-Data-Table'[Flavor] IN { "Vanilla", "Strawberry" }

)

 

VAR LocationCounts =

ADDCOLUMNS(

SUMMARIZE(

FilteredTable,

'Flavors-Sold-Data-Table'[Location]

),

"FlavorCount",

CALCULATE(COUNTROWS(FilteredTable))

)

 

VAR TopLocation =

TOPN(

1,

LocationCounts,

[FlavorCount], DESC

)

 

RETURN

MAXX(TopLocation, 'Flavors-Sold-Data-Table'[Location])


If you find our response helpful, we kindly request you to mark it as the accepted solution and consider giving kudos. This will assist other community members who may have similar queries.

Thank you.




jerryr125
Helper III
Helper III

Hi again - I think I defined my requirements incorrectly.

 

Input:

Flavors-Sold-Data-Table

 

LocationFlavor
AVanilla
BStrawberry
BVanilla
AStrawberry
BStrawberry
BVanilla
BChocolate
AVanilla
AChocolate
AChocolate

 

I would like show the location with the maximum count of  flavor if the flavor is either Vanilla or Strawberry.

The output in the Measure I am looking for would be "B" since B has the highest count of the flavor Vanilla and Strawberry (4).

 

Any thoughts?

v-pnaroju-msft
Community Support
Community Support

Thank you, @Deku , for your response.


Hi @jerryr125,

We appreciate your query posted on the Microsoft Fabric Community Forum.

In addition to the response provided by @Deku , please find below the DAX measure which may help resolve the issue:

FlavorWithMaxAmount =

CALCULATE(

SELECTEDVALUE('Table'[Flavor]),

FILTER(

'Table',

'Table'[Amount] = MAX('Table'[Amount])

)

)

If you find our response helpful, we kindly request you to mark it as the accepted solution and consider giving kudos. This will assist other community members who may have similar queries.

Thank you.

Deku
Super User
Super User

Flavour with highest amount=

MAXX(

Topn(

1,

Table,

Table[amount],

Desc

),

Table[flavour]

)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

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.