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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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