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
Nikhil_D
Frequent Visitor

DAX ,Find Max

Hello!  I have a problem and have a feeling a simple DAX formula can solve it. 

 

I would like the 'Output' column to be created with 'Seconds' column.

 

For PID 3 , Seconds are repeated and I need Only one entry in "Output" Column and for PID 2, I need only Max Seconds.

 

 

Capture.JPG 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Nikhil_D , You need to add an index column in power query

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

 

then try Dax formula 

output = var _1 = maxx(filter(Table, [pid] = earlier([pid])), [second])
return
if([index] = maxx(filter(Table, [pid] = earlier([pid]) && [second] =_1), [index]) , [second], blank())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Nikhil_D , You need to add an index column in power query

https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

 

then try Dax formula 

output = var _1 = maxx(filter(Table, [pid] = earlier([pid])), [second])
return
if([index] = maxx(filter(Table, [pid] = earlier([pid]) && [second] =_1), [index]) , [second], blank())

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak ,

 

Thanks for your answer. I followed u r steps but didn't get solution.

I think I have not explained clearly.

 

So let me tell u clearly.

I have tabel as below mentioned and I need "Output" Column.

PID Column have Duplicates and I can not remove those duplicates. I need those for another purpose.

What I need is Calcute P_Second based on PID.

If P_Seconds are Unique for PID, I need only one entry in 'Output' column.

If it is not Unique and I need Max Secons in 'output' column.

if PID is Null, I need it Null only.

 

Nikhil_D_0-1625855973985.png

 

Thanks

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.