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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Strahinja
New Member

AVERAGE of subtraction two columns with condition

Hello guys,

 

I have some maybe easy question for you, but I am new in DAX and its difficult for me.

 

I want to create one mesare without adding new column. 

Measure shoul calculate average of end_date - start_date. But there is one condition. If differece between end_date and start_date smaller than two (end_date - start_date < 2) , that row should not count towards the average. 

 

And, at the end I want to Measure be in form on integer.

 

Strahinja_0-1667425646664.png

 

Thank you guys! 😄 

 

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

AVERAGEX(Table,VAR _diff=Table[End date]-Table[Start Date] RETURN IF(_diff>2,_diff))

View solution in original post

2 REPLIES 2
Strahinja
New Member

Thank you my brother @wdx223_Daniel 😄

I am really thankful!!! 😎

wdx223_Daniel
Super User
Super User

AVERAGEX(Table,VAR _diff=Table[End date]-Table[Start Date] RETURN IF(_diff>2,_diff))

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.