Forum Discussion
Create Measure: Average Sales Per Week Per Country
- Anonymous2 years ago
Hi MichaelG1117 ,
Maybe you can try this DAX:Average Amount Per Country Per Week = VAR Total_Order = SUMX ( 'Order', 'Order'[SalesPrice] * 'Order'[OrderQuetity] ) RETURN IF ( ISFILTERED ( 'Order'[Country] ), Total_Order, Total_Order/55 )
And here is my test data:What this DAX means is that if the Country fields are not filtered, their respective corresponding sum values are returned, and if they are filtered (AVG rows) the average value is returned. It is mainly these codes that play a role:
IF ( ISFILTERED ( 'Order'[Country] ), Total_Order, Total_Order/55 )You can change the rest to suit your needs.
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
Thanks for your response. Everything in that equation is good except it does not allow me to put in:
"Total Sales", 'Orders'[OrderQuantity] * 'Orders'[SalesPrice]
I replaced this line with what it did allow, namely a measure I had created previously "Order Amount":
But when I put this in the numbers came out wrong on the Matrix Visual.
Here is the Data for the "Orders" Table:
Here are the relationships:
I created the date table. Do I need to connect it with "Territories"?
Or do I just need to find a way to write 'Orders'[OrderQuantity]*'Orders'[SalesPrice] in your equation in a way that works?
I am not allowed to created any calculated columns.
Again, thanks for your help and any further help would be greatly appreciated.
I want to understand how the no. of weeks is 55. According to my calculations the difference between 24 jan 2013 and 27 Jan 2014 is 53 weeks. Can you elaborate? I am solving the same question.