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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
fisqkuz1
Frequent Visitor

average of sumx calculation where results of measure > 0

Hi,

 

I am looking to get the average of a column which was calculated with SUMX. If get that it's not working because dax doesn't know the context, however I can't seem to figure this out.

 

Example:

 

test = SUMX(table1, table1[c1] - table1[2])

and then I want IF test > 0 -> take into account to average.

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @fisqkuz1 

 

You can try this measure

AVG = AVERAGEX(FILTER('Table1','Table1'[C1]-'Table1'[C2]>0),'Table1'[C1]-'Table1'[C2])

 

Below is my sample data and measure result. 

vjingzhang_0-1648806956162.png

 

If this is not what you want, can you provide some sample data and expected result so that we can try to come up with a more accurate solution?

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @fisqkuz1 

 

You can try this measure

AVG = AVERAGEX(FILTER('Table1','Table1'[C1]-'Table1'[C2]>0),'Table1'[C1]-'Table1'[C2])

 

Below is my sample data and measure result. 

vjingzhang_0-1648806956162.png

 

If this is not what you want, can you provide some sample data and expected result so that we can try to come up with a more accurate solution?

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

amitchandak
Super User
Super User

@fisqkuz1 , if Test is a measure it needs a group by to check >0

 

Averagex(filter(Values(Table[Column]), [Test] >0), [Test])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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