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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.