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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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