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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kekepania0529
Helper I
Helper I

AVERAGEX formula help

I have the following excel formula that I need to convert to DAX for Power BI (Power BI column names are in italics within the excel formula):

Area Sell Contract Price = IFERROR(SUMIFS('Sell Contract Details'!$Z:$Z Sell Extended Price, 'Sell Contract Details'!$D:$D Area, 'Inbound Details'!$H14 Area, 'Sell Contract Details'!$L:$L Product Class, 'Inbound Details'!$B14 Material Grade) / SUMIFS('Sell Contract Details'!$Y:$Y Sell Order LB, 'Sell Contract Details'!$D:$D Area, 'Inbound Details'!$H14 Area, 'Sell Contract Details'!$L:$L Product Class, 'Inbound Details'!$B14 Material Grade), "")

 

Sell Contract Details and Inbound Details are unrelated tables in my Power BI report. I cannot create a relationship because neither table has a unique identifier (many:many). The join is on Inbound Details.Area = Sell Contract Details.Area and Inbound Details.Material Grade = Sell Contract Details.Product Class.

 

I was able to get the Average Sell Contract Price with the following DAX formula:

 

Area Sell Contract Pricing = AVERAGEX(FILTER('Sell Contract Detail','Sell Contract Detail'[Area] = 'Inbound Detail'[Area] && 'Sell Contract Detail'[Product Class Desc] = 'Inbound Detail'[Material Grade]), DIVIDE('Sell Contract Detail'[Sell Order Extended Price 2],'Sell Contract Detail'[Sell Ordered LB 3],0))

 

...but if there is more than 1 'Inbound Details'[Loads] per 'Inbound Detail'[Supplier], the result is the 'Sell Contract Detail'[Average Sell Price] * 'Inbound Detail'[Loads].

 

I tried DIVIDE('Sell Contract Detail'[Average Sell Price],'Inbound Detail'[Loads],0)), but the result is the same.

 

Any suggestions?

1 REPLY 1
MFelix
Super User
Super User

Hi @kekepania0529 ,

 

Without data is difficult to give any correct way of formulating the measure.

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.