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
Anonymous
Not applicable

Return Earliest Text Value to all rows of a group

Hi Community,

 

I need help with DAX through PowerPivot (not PowerBI).
I am trying to get the earliest ID of a subset(group) assigned to all rows of that group. The output I am trying to achieve is bellow *Last column - Earliest Unique ID.

 

Any idea how to achieve this without usage of VAR (It does not work for my Excel version)

Case IDRank within GroupUnique ID??? Earliest Unique ID
1111
1221
1331
2144
2254
3166
4177
2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous ,

new column  =

minx(filter(Table, [Case ID] =earlier([Case ID])), [Unique ID] )

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

Richard_100
Resolver I
Resolver I

Hello

 

This worked for me, although I am not sure about backwards compatibility with Excel versions of DAX.

 

I changed your example table slightly to make Unique ID contain some non-numbers and then focused the solution on the rank rather than minimum Unique ID number, assuming that the rank of a Unique ID might be completely unconnected with the value of the ID itself.

 

Richard_100_0-1643800441010.png

 

This works by filtering the table down to a single row (based on Case ID, referencing the row context of the underlying table via the EARLIER function and the Rank) and a single column, thereby becoming a single cell that DAX can return as a scalar value into the row (tables of one row and column can be treated as both tables and scalars) 

 

=SELECTCOLUMNS(

             FILTER(Table1, ([Case ID]=EARLIER([Case ID])) && [Rank within Group]=1),

             "@Unique", [Unique ID])

 

Hope that helps

 

Regards

Richard

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hey @Richard_100  and @amitchandak 

 

I managed to achieve it by combining your 2 suggestions:
=minx(filter(Table, [Case ID] =earlier([Case ID]) && [Rank within Group]=1), [Unique ID] )

Unfortunatelly SELECTCOUMN does not work in Excel PowerPivot I have.
The only thin is that I had to format Unique Value as number (last digit get converted to 0) and work around scientific format. But this resolved what I need it for.

Thanks a lot!

Richard_100
Resolver I
Resolver I

Hello

 

This worked for me, although I am not sure about backwards compatibility with Excel versions of DAX.

 

I changed your example table slightly to make Unique ID contain some non-numbers and then focused the solution on the rank rather than minimum Unique ID number, assuming that the rank of a Unique ID might be completely unconnected with the value of the ID itself.

 

Richard_100_0-1643800441010.png

 

This works by filtering the table down to a single row (based on Case ID, referencing the row context of the underlying table via the EARLIER function and the Rank) and a single column, thereby becoming a single cell that DAX can return as a scalar value into the row (tables of one row and column can be treated as both tables and scalars) 

 

=SELECTCOLUMNS(

             FILTER(Table1, ([Case ID]=EARLIER([Case ID])) && [Rank within Group]=1),

             "@Unique", [Unique ID])

 

Hope that helps

 

Regards

Richard

Anonymous
Not applicable

Hey @amitchandak 

 

Apologies as i failed to mention, that I am trying to get the Earliest ID using the rank column (Need to assign Unique ID with Rank 1 to all rows of the group).

Also, Case id is formated as text (20char, so numbers transform to scietific formating).

Thanks a lot!!!

amitchandak
Super User
Super User

@Anonymous ,

new column  =

minx(filter(Table, [Case ID] =earlier([Case ID])), [Unique ID] )

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

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.