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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Toluhenok
Regular Visitor

How to fill null values with mean in a missing data

Filling missing valuesFilling missing values

Hello, I need help filling the nulls in the attached screenshot with the mean of that column. How do I go about it?

1 ACCEPTED SOLUTION

Hi @Toluhenok ,

 

Try it by deleting #"Changed Type" (second last row):

tomfox_0-1657903787524.png

 

Hope this helps! 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

View solution in original post

4 REPLIES 4
tackytechtom
Super User
Super User

Hi @Toluhenok ,

 

Here an example. Before:

tomfox_0-1657828105996.png

 

 

After:

tomfox_1-1657828129466.png

 

Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlSK1YlWyivNyQEzjFC5xqhcE1SuKRI3FgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Number = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Number", Int64.Type}}),
    #"Replace Values" = Table.ReplaceValue(#"Changed Type",each [Number],each if [Number] = null then List.Average(#"Changed Type"[Number]) else [Number], Replacer.ReplaceValue,{"Number"})
in
    #"Replace Values"

 

Let me know if this helps 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Thank you for the reply, however, I keep getting an Expression.SyntaxError: Token Eof expected

bi.png

Hi @Toluhenok ,

 

Try it by deleting #"Changed Type" (second last row):

tomfox_0-1657903787524.png

 

Hope this helps! 🙂

 

/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/

 



Did I answer your question➡️ Please, mark my post as a solution ✔️

Also happily accepting Kudos 🙂

Feel free to connect with me on LinkedIn! linkedIn

#proudtobeasuperuser 

Yes, thank you

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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