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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Help to find DAX to Average Vlookup Value Across Multiple Rows With Same Unique Identifier

Hello,

So, I'm trying to figure out a DAX that will take the Lookup (Vlookup) value and average across multiple rows (part numbers), based on the count of rows with a unique identifier (Document #). I'm thinking it should be the LOOKUP value divided by the COUNTIF function, but not sure...can someone provide some insight on how to properly do this? 

 

In the below screen shot example you can see, Document #7374 has 3 different "WOMP Tag #" these are part numbers created on each Document. However, on the far right Vlookup Costs & Vlookup Hrs are allocating the totals for that Document 3 different times. I need the totals averaged by 3 or by sum of rows counted with same Document #. 

 

Capture.PNG

 

Regards,

Kyle

2 REPLIES 2
dedelman_clng
Community Champion
Community Champion

Hi @Anonymous -

 

Based on what you described, I think you can use something like AVERAGEX

 

VLookup_Avg =
AVERAGEX (
    VALUES ( '2021 Production'[Document #] ),
    '2021 Production'[Vlookup No]
)

 

Without having your data I wasn't able to test, so see if this gets you were you want to go.

 

Hope this helps

David

Anonymous
Not applicable

Thanks for the input. I actually ended up creating another table and through Power Query Editor replicated a CountIF function to count number of lines for each Document #, then through a lookup formula divided that by total costs & labor hours. Probably not the most efficient way, but everything works now! Examples below...

 

Count Doc# Lines = LOOKUPVALUE ( 'W.O. Qty Table '[Count Part #] , 'W.O. Qty Table '[Document #] , '2021 production'[Document #] , 'W.O. Qty Table '[Document #] , '2021 production'[Document #] )

 

Avg Costs = DIVIDE ( '2021 production'[Vlookup Costs] , '2021 production'[Count Doc# Lines] )
Avg Hrs = DIVIDE ( '2021 production'[Vlookup Hrs] , '2021 production'[Count Doc# Lines] )power bi.PNG

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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