Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
I am trying to calculate the average of a column in power query. The column does have some null values but I've tried replacing them and I still can't get List.Average() to work.. I am getting the error message that it can't convert the value to a list. Any thoughts on how to do this in M? Picture is attached below
Solved! Go to Solution.
Hi @johankent30
I take it you want the same average value in every row of the new colum.
The code for the Added Custom step should be
= Table.AddColumn(#"Changed Type", "Custom", each List.Average(#"Changed Type"[CashFlow_Cust.Due_Days]))
Is that what you are seeing in the formula bar?
It's working in a test query I created similar to yours, with a mixture of numbers and nulls.
Regards,
Owen
Hi @johankent30
I take it you want the same average value in every row of the new colum.
The code for the Added Custom step should be
= Table.AddColumn(#"Changed Type", "Custom", each List.Average(#"Changed Type"[CashFlow_Cust.Due_Days]))
Is that what you are seeing in the formula bar?
It's working in a test query I created similar to yours, with a mixture of numbers and nulls.
Regards,
Owen
Hi,
I am a newbie to PowerQuery, the above solution is very good. However, I have a little more complex query on this.
Suppose I have Country column, Value column. Now I wanted to average the Value column not equal to 0, for each country in the country column. Kindly see the below example.
Let me know if you have any questions.
Thank you...
Vj
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 28 | |
| 28 | |
| 26 | |
| 22 | |
| 18 |
| User | Count |
|---|---|
| 52 | |
| 49 | |
| 43 | |
| 38 | |
| 36 |