cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Janosa
New Member

Custom column

Hello everyone,

 

i'm just a beginner with power query so i'm not sure how to solve this issue i have.

I'm looking to add a custom column where if the weight value is zero then it should take the average weight of all products with the same code on that exact date.

 

for example:

DateProduct codeweightCustom Column
1-sep12340average weight based on product code date 1-09 = 1
1-sep123411
2-sep123422
2-sep12340average weight based on product code date 2-09 = 2
3-sep123411
3-sep123422
3-sep12340average weight based on product code date 3-09 = 1,5

 

is this possible in power query or should I approach it differently?

 

thanks in advance

1 ACCEPTED SOLUTION
HotChilli
Super User
Super User

I think you want the average of the non-zero entries for the same date.

Here's what I would do:

Duplicate the query.

Filter out the 0 entries (from the column header).

'Group By' Date and Product Code with a new column for the Average of Weight

---

Merge this table back to the original table on (Date, Product Code) to get the Average on each row.

View solution in original post

1 REPLY 1
HotChilli
Super User
Super User

I think you want the average of the non-zero entries for the same date.

Here's what I would do:

Duplicate the query.

Filter out the 0 entries (from the column header).

'Group By' Date and Product Code with a new column for the Average of Weight

---

Merge this table back to the original table on (Date, Product Code) to get the Average on each row.

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors