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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
GeekAlfPro
Helper V
Helper V

Firstnonblankvalue in M

Hello,

 

i'm looking for the equivalent of firstnonblankvalue in M.

 

Thanks !

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Write it like this:

 

{{"Max SOC", each List.FirstN([State of Charge], each _ <> null){0}, type nullable number})

 

--Nate

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @GeekAlfPro ,

 

Since we only need to get the first non-null value, our idea can be converted to delete the unnecessary null value first, and add the custom column to return the first row by group.

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Write it like this:

 

{{"Max SOC", each List.FirstN([State of Charge], each _ <> null){0}, type nullable number})

 

--Nate

Thanks @Anonymous 

it almost works, but i have some errors

Expression.Error: There were not enough items in the enumeration to complete the operation.
Details:
    [List]

that's strange because i have a value with Dax for the day and the internal_id that i checked

I have about 880000 rows, can it explain the error message ?

i'm stuck with this issue...

i checked my datas and i still don't understand why it works with dax but not with M

to check, i remove the {0} of your formula to get a list :

GeekAlfPro_0-1646822676192.png

the list is empty, despistes i have datas....

 

GeekAlfPro
Helper V
Helper V

hello @Anonymous ,

 

in a column, i want the firstnonblankvalue in a group.

i tried this but, it returns me a list not a single value : 

= Table.Group(Source, {"Internal_id", "timestamp"}, 
{{"Max SOC", each List.FirstN({[State of Charge]}, each _[State of Charge]<> null), type nullable number})
Anonymous
Not applicable

In a column or a row?

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.