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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
MYDATASTORY
Resolver I
Resolver I

How calculate the Average Sales by Country and Month

I have below dummy data, and I would like to calculate Average sales by Country and Date(Month) and if one country is selected should show average sales by month selected and the country selected (I have converted date as slicer i.e Nov1987 & Mar 1988).

For example, if I select Sweden and select Date Slicer for November 1987  the Average will be 90 (80+100)Divide by 2 .

Date      Sales  ID Country 
10/11/19878010Sweden
11/11/198710011Sweden

If they select  Month: Nov 1987 and March 1988 and Filter Sweden they should get  Average of 64.5 because the total sum of the selected filer is 645 then divide by selected values which are 10 (645/10)=64.5

Date    Sales  ID    Country 
10/11/19878010Sweden
11/11/198710011Sweden
01/03/19885012Sweden
02/03/19884013Sweden
03/03/19885014Sweden
04/03/19885015Sweden
05/03/19885016Sweden
06/03/19887517Sweden
07/03/19887518Sweden
08/03/19887519Sweden

Below is the full data dump (unfiltered )used on the above examples and I would like to calculate Average sales by Country and  Date (Month) selected. Thank you.

 

I have tried below  DAX but don't seem to filter all Average by Month and Country selected.

AverageX Sales =
CALCULATE(AVERAGEX(
'Sales Table','Sales Table'[Total Salesx]),
FILTER(ALL('Sales Table'),
'Sales Table'[Country ]=SELECTEDVALUE('Sales Table'[Country ])))
 
I have also tried below DAX
Averagex = AVERAGEX(VALUES('Sales Table'[Date]),[Total Sales])

                                      

Date  Sales   ID  Country 
01/11/19871001Turkey
02/11/1987502Turkey
03/11/19871003Turkey
04/11/19871004Turkey
05/11/1987505Turkey
06/11/19871006Turkey
07/11/1987807Turkey
08/11/19871008Turkey
09/11/19871009Turkey
10/11/19878010Sweden
11/11/198710011Sweden
01/03/19885012Sweden
02/03/19884013Sweden
03/03/19885014Sweden
04/03/19885015Sweden
05/03/19885016Sweden
06/03/19887517Sweden
07/03/19887518Sweden
08/03/19887519Sweden
09/03/19885020Germany
10/03/198820021Germany
11/03/19887522Germany
12/03/19887523Germany
13/03/19884024Germany
14/03/19887525Germany
15/03/19887526Germany
16/03/19887527Germany
17/03/19886028Germany
18/03/19886028Germany
19/03/19886028Germany
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @MYDATASTORY ,

 

Believe this post is duplicated with the one below can you please delete it.

 

https://community.powerbi.com/t5/Desktop/How-calculate-Average-sale-by-country-and-date/m-p/1202061


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



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @MYDATASTORY ,

 

Believe this post is duplicated with the one below can you please delete it.

 

https://community.powerbi.com/t5/Desktop/How-calculate-Average-sale-by-country-and-date/m-p/1202061


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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.