# Calculating Average Warehouse Code sales

Hi All I am confused about two DAX formulas that works very closely when Calculating Average Warehouse Sales. I have Sales Table and Date Table. In Sales table I have Warehouse Code ,Unit Price, Order Quantity, Order Date, Total Revenue( Unit price * Order quantity) and so on…
Date Table is connected to Sales Table ( one to many relationship)

Total Sales (Measure) = SUM( Sales[Total Revenue])

I want to calculate date wise Average Warehouse Sales

1. = AVERAGEX(VALUES[Sales(Warehouse Code)], [Total Sales])

2. = CALCULATE(AVERAGE([Total Sales], VALUES[Sales(Warehouse Code)])

Which one is correct and why? both are giving same result on some dates and on some dates its different. Please any one explain briefly

Second formula how it works? which results it gives?

@Sai First one is correct, did you make a mistake in writing the second code?

Hi @Sai, we aim to consistently improve the topics being posted on the forum to help you in getting a strong solution faster. While waiting for a response, here are some tips so you can get the most out of the forum and other Enterprise DNA resources.

• Use the forum search to discover if your query has been asked before by another member.
• When posting a topic with formula make sure that it is correctly formatted to preformatted text </>.
• Use the proper category that best describes your topic
• Provide as much context to a question as possible.
• Include the masked demo pbix file, images of the entire scenario you are dealing with, screenshot of the data model, details of how you want to visualize a result, and any other supporting links and details.

I also suggest that you check the forum guideline How To Use The Enterprise DNA Support Forum. Not adhering to it may sometimes cause delay in getting an answer.