March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
16 | |
13 | |
12 | |
9 |
User | Count |
---|---|
36 | |
31 | |
20 | |
19 | |
17 |