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
GeekAlfPro
Resolver II
Resolver II

Firstnonblankvalue in M

Hello,

 

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

 

Thanks !

1 ACCEPTED SOLUTION
watkinnc
Super User
Super User

Write it like this:

 

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

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

View solution in original post

7 REPLIES 7
v-stephen-msft
Community Support
Community Support

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.

watkinnc
Super User
Super User

Write it like this:

 

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

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

Thanks @watkinnc 

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
Resolver II
Resolver II

hello @watkinnc ,

 

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})
watkinnc
Super User
Super User

In a column or a row?


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

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