Forum Discussion
AVERAGEX from multiple tables
- Anonymous8 years ago
In order to achieve this, we will need a Date Table and you will need to have this linked to both of your Actuals and Volume tables. Your date table will need a "YearMonth" style column to help us detiremine what a single month is.
First, you want to create a measure first that does the base job you seek, which is to get an average price regardless of context. Something like
Price = DIVIDE( Sum(ActualsTable[Revenue]), Sum(VolumeTable[Qty]) )
From here, you will want to run this particular measure for each month and get an average of those results, run under the context of each product. This can be done as a measure (best practice) or as a custom column should you have that particular need. The columns code would be:
MnthlyAvgPrice = AVERAGEX( values('Dim - Date Table'[YearMonth]), [Price] )
Hi rhildeb,
Add a calendar table and relate it to the other two table then add the following measure:
Average =
CALCULATE (
DIVIDE ( SUM ( ActualsTable[Revenue] ); SUM ( VolumeTable[Qty] ) );
ActualsTable
)On your visual place date from Calendar, Product from products and the measure.
Regards,
MFelix