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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
jerryr125
Helper III
Helper III

Display a description in a measure based upon a count of another variable

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?

1 ACCEPTED SOLUTION

Var tbl =

Addcolumns(

All(Table),

"@cnt",

Calculate(

Countrows( table ),

Table[flavor] in {"vanilla", "strawberry"}

)

)

Return

Max(

Topn( 1, tbl, [@cnt], desc),

[@cnt]

)

 

Not sure about the button part


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

View solution in original post

5 REPLIES 5
jerryr125
Helper III
Helper III

HI - This is working - thank you.

Question - what if I want to have a seperate measure showing the number (in this case 4).

 

Also, how can I set up image button (like click here for more details) that will go to another page of the table data and only show those four records  ?

max count  = 
var a = SUMMARIZE(filter('Table',[Flavor] in {"Vanilla","Strawberry"}),[Location],"ct",COUNTROWS('Table'))
return MAXX(a,[ct])

 

The button would have to be tied to a sort of filter (bookmark) to be efficient. Otherwise you could just add a static table, and you would need to define what you mean by "more details"

Var tbl =

Addcolumns(

All(Table),

"@cnt",

Calculate(

Countrows( table ),

Table[flavor] in {"vanilla", "strawberry"}

)

)

Return

Max(

Topn( 1, tbl, [@cnt], desc),

[@cnt]

)

 

Not sure about the button part


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

Var tbl =

Addcolumns(

All(Table),

"@cnt",

Calculate(

Countrows( table ),

Table[flavor] in {"vanilla", "strawberry"}

)

)

Return

Max(

Topn( 1, tbl, [@cnt], desc),

Table[location]

)

 


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

lbendlin_0-1744116879515.png

 

max count location = 
var a = SUMMARIZE(filter('Table',[Flavor] in {"Vanilla","Strawberry"}),[Location],"ct",COUNTROWS('Table'))
return CONCATENATEX(TOPN(1,a,[ct]),[Location])

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors