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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
SimonDoras
Regular Visitor

Create a column that shows the max of another column

Hello everyone,

 

I'm new to Power Bi, and usually I quickly find an answer to my beginner's questions. But here whether it's with the forums, the official doc or even chatGPT I can't find it.. whereas I think my question is rather simple.

 

I have several tables that are all in the same format.

In column: Title | Column A | Column B | ID

-> The ID is necessarily different (increment automatically in my initial database). The two columns that I would like to add (I think it's easier by breaking it down):

- A "MaxID" column that indicates the highest ID for all rows with the same title.

- An "Active" column with "yes" or "no" if the maxID is equal to the row ID in question.

 

An example of a table before transformation:

 

TitleColumn AColumn BId
AAabcdabcd1
AAabcdabcd2
BBabcdabcd3
CCabcdabcd4
CCabcdabcd5
AAabcdabcd6

 

The result I expect:

 

TitleColumn AColumn BIdMaxIDActive
AAabcdabcd16no
AAabcdabcd26no
BBabcdabcd33yes
CCabcdabcd45no
CCabcdabcd55yes
AAabcdabcd66yes

 

Hoping to have been clear, thank you for your help!

 

Simon

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

4 REPLIES 4
Ahmedx
Super User
Super User

pls try this

Screen Capture #1361.pngScreen Capture #1362.png

It's perfect ! 


A question, what is the advantage or the disadvantage of doing it in the table directly and not in the "transform the data" part?

if you want to know how to implement this in POWER QUERY then watch my video

https://1drv.ms/v/s!AiUZ0Ws7G26RiSpsfTgnxMVCfJLB?e=S7zoVp

(x)=> Table.AddColumn(x,"MAXID", each List.Max(x[Id]))

 

Hi @SimonDoras 

The DAX solution proposed by @Ahmedx is faster than doing it in PQ as DAX is more optimized at scanning a table than M





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

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.