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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
orangebloss
New Member

Returning Column Name of first non- Null value

I have a CSV file I'm using as a source, I'm needing to return the column name of the first non-null value in a row. 

 

In Excel I'd use a simple index match. I've worked out how to return the first non null value but still can't quite fathom how to return the column name.

 

Any help very much appreciated.

1 ACCEPTED SOLUTION
slorin
Super User
Super User

Add a List.RemoveFirstN

List.Skip(List.RemoveFirstN(List.Zip({Record.FieldValues(_), Record.FieldNames(_)}),4), each _{0}=null){0}{1}

Stéphane 

View solution in original post

4 REPLIES 4
slorin
Super User
Super User

Add a List.RemoveFirstN

List.Skip(List.RemoveFirstN(List.Zip({Record.FieldValues(_), Record.FieldNames(_)}),4), each _{0}=null){0}{1}

Stéphane 

Brilliant thank you!!!

slorin
Super User
Super User

Hi

Add a new column

List.Skip(List.Zip({Record.FieldValues(_), Record.FieldNames(_)}), each _{0}=null){0}{1}

 Stéphane

Thanks - that's almost there, however the columns I'm searching start at column 5 (first four columns are populated) how would I change this to accomodate this?

 

It also seems to return the same result for every row?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors