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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
mstoppelman
New Member

Show which rows in a group have a specific value

Hi, my data is structured as below with my expected result (calculated column)

 

GroupNumberCalculate Column

a

1y
a2y
a3y
b1y
b2y
b3y
c1n
c2n
d1n

 

so basically I want all the rows in each group to show "y" if one row in the group has the highest number in column b, and to show n if a group does not have the highest number.

my formula that I've tried is listed below, but it has not worked, any help is greatly appreciated

 

calculated column = if(calculate(countrows(table), group = earlier(group), number = max(number)) > 0, "y", "n")

1 ACCEPTED SOLUTION
SamWiseOwl
Super User
Super User

Hi @mstoppelman 

Highest value y/n =
var CurrentGroup= List[Group] --Capture the current row value
var grouphigh = CALCULATE(max(List[Number]), all(list),List[Group] = CurrentGroup)
--Return the max number, unfilter table, refilter to where the group equals original group
return
if(
    grouphigh = max(List[Number]), "y", "n") --if the overall highest number equals the group high y/n
If this helped please mark it as a solution for others to find 🙂


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

View solution in original post

4 REPLIES 4
SamWiseOwl
Super User
Super User

Hi I'm guessing at your table name, so replace list with your table name 


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Oh I see, that works now thanks so much!

SamWiseOwl
Super User
Super User

Hi @mstoppelman 

Highest value y/n =
var CurrentGroup= List[Group] --Capture the current row value
var grouphigh = CALCULATE(max(List[Number]), all(list),List[Group] = CurrentGroup)
--Return the max number, unfilter table, refilter to where the group equals original group
return
if(
    grouphigh = max(List[Number]), "y", "n") --if the overall highest number equals the group high y/n
If this helped please mark it as a solution for others to find 🙂


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Hi, thanks for the reply. For the column syntax, is "List" a function? Or a name? When I try to enter the syntax in, PowerBi doesn't have List as a function

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.