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

Be 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

Reply
bklyn3
Advocate II
Advocate II

Average value based on two columns in another table

Hello PowerBI community

 

I have two tables PreviousOrders and FutureOrders.

 

PreviousOrder

Facility

Processing Time

OrderType

A

13

Express

A

15

Normal

B

19

Express

C

10

Normal

A

11

Express

B

15

Express

B

13

Express

C

14

Normal

 

FutureOrders.

Facility

OrderType

ExpectedTime

A

Express

=averageif(A and Express in First table)

B

Express

 

C

Express

 

C

Normal

 

A

Express

 

A

Normal

 

B

Express

 

C

Normal

 

 

 

I would like the ExpetedTime in the “FutureOrders” table to be the "Processing Time" for that facility and order type based on the data in PreviousOrder.

 

Is there an easy way to do this in DAX? 

 

Thank you

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @bklyn3 

you build a many to many relationship between the two tables based on the facity column. Then New column

AVERAGEX (

FLITER (

RELATEDTABLE ( PreviousOrder ),

PreviousOrder[OrderType] = FutureOrders[OrderType] 

),

PreviousOrder[Processing]
)

View solution in original post

3 REPLIES 3
jeroendekker
Frequent Visitor

Ì know this is solved but I would like propose a alternative without DAX in Power Query

Merge both tables

jeroendekker_0-1653075017373.png

Expand using aggregate option --> sum (average not directly available)

jeroendekker_1-1653075099453.png

Change List.Sum to List.Average in the formula.

 

jeroendekker_2-1653075193921.png

Done, no many-2-many needed.

jeroendekker_3-1653075377140.png

 






bklyn3
Advocate II
Advocate II

Thank you

tamerj1
Super User
Super User

Hi @bklyn3 

you build a many to many relationship between the two tables based on the facity column. Then New column

AVERAGEX (

FLITER (

RELATEDTABLE ( PreviousOrder ),

PreviousOrder[OrderType] = FutureOrders[OrderType] 

),

PreviousOrder[Processing]
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.