Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have one table with missing value for unit price column. I want fill this in power query with average. I am able to fill the null with entire column average. But I want to consider the product name column while finding the average. I want group by average to fill the null missing unit price column Please help me to get some solution
So far I tried with below code : =
if [unit price] = null then List. Average(#"Added Custom"[unit price]) else [unit price]
But here I don't know how to consider the product name while finding the average
| Product Name | Unit Price |
| A | null |
| A | 30.1 |
| A | 42.9 |
| B | 48.7 |
| B | 56.8 |
| B | 60.3 |
| C | 22.0 |
| C | null |
| C | 24.3 |
Solved! Go to Solution.
Duplicate the Query - (let's call it 2ndTable).
In 2ndTable, do a Group By on Product, using average of the Unit price as aggregation.
--
Merge the original table with 2ndTable on ProductName to bring the average back to the original table.
You can then have
Product 'UnitPrice' avg in the resulting table.
--
Add a custom column to either return UnitPrice or avg if UnitPrice is null
Duplicate the Query - (let's call it 2ndTable).
In 2ndTable, do a Group By on Product, using average of the Unit price as aggregation.
--
Merge the original table with 2ndTable on ProductName to bring the average back to the original table.
You can then have
Product 'UnitPrice' avg in the resulting table.
--
Add a custom column to either return UnitPrice or avg if UnitPrice is null
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!