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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Samsam
New Member

Get average of value based on two filters

Hi there,

 

I am trying to create a measure that shows the average value of a column based on two filters. Sample dataset is below:

 

Table Name:Sample Data
LocationValueDate
NY1531/01/22
NY1231/01/22
NY1331/01/22
NY4825/04/22
NY1625/04/22
NY2325/04/22
MD816/11/22
MD5413/11/22
CA308/08/22
CA1008/08/22

 

I need to get the average value of NY based on the same date. In this case, the desired result should look like this:

 

Table Name:Sample Data
LocationDateAverage
NY31/01/2213.33
NY25/04/2229
MD16/11/228
MD13/11/2254
CA08/08/226.5

 

I've created this DAX measure:

AVERAGEX(
 SUMMARIZE(
  FILTER('Sample Data','Sample Data'[Location]="NY"),
   'Sample Data'[Date],
   'Sample Data'[Value]
),
'Sample Data'[Value]

)

But it's not giving me the desired output. Do I need to group the dates? Please help. Thank you

1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

Hi Samsam, 

 

I would create a calcualted table as below:

 

TABLE3 =
VAR TABLE1 =
    SUMMARIZE ( 'Table', 'Table'[Location], 'Table'[Date] )
VAR TABLE2 =
    ADDCOLUMNS ( TABLE1, "Value", CALCULATE ( SUM ( 'Table'[Value] ) ) )
RETURN
    TABLE2
 
It works and returns below:
FreemanZ_0-1666837206384.png

 

View solution in original post

3 REPLIES 3
FreemanZ
Super User
Super User

I am not sure about your use case for the mentioned measure. You could plot the expected table with the existing columns easily like below:

FreemanZ_1-1666837497905.png

 

FreemanZ
Super User
Super User

Hi Samsam, 

 

I would create a calcualted table as below:

 

TABLE3 =
VAR TABLE1 =
    SUMMARIZE ( 'Table', 'Table'[Location], 'Table'[Date] )
VAR TABLE2 =
    ADDCOLUMNS ( TABLE1, "Value", CALCULATE ( SUM ( 'Table'[Value] ) ) )
RETURN
    TABLE2
 
It works and returns below:
FreemanZ_0-1666837206384.png

 

This worked! Thank you so much, FreemanZ. I've been raking my brains out since yesterday to find solution to this. I greatly appreaciate your help. 🙂

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.