Forum Discussion

GeekAlfPro's avatar
GeekAlfPro
Helper V
4 years ago
Solved

Firstnonblankvalue in M

Hello,

 

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

 

Thanks !

  • Anonymous's avatar
    Anonymous
    4 years ago

    Write it like this:

     

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

     

    --Nate

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Write it like this:

     

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

     

    --Nate

    • GeekAlfPro's avatar
      GeekAlfPro
      Helper V

      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

      • GeekAlfPro's avatar
        GeekAlfPro
        Helper V

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

        i'm stuck with this issue...

  • Anonymous's avatar
    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's avatar
    Anonymous
    Not applicable

    In a column or a row?

  • 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})