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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors