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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Applicable88
Impactful Individual
Impactful Individual

Calculate average duration without duration =< 1 second

Hello, 

what is the best way to calculate average duration but disregard durations smaller or equal 1 second?

My measure for all duration is now like this:

 

Measure= CALCULATE(AVERAGE('Machine'[Duration]))
 
Thank you very much in advance.
Best. 
2 ACCEPTED SOLUTIONS

@Applicable88  Yes, you can.

 

AVERAGEX(FILTER('Machine', 'Machine'[Duration] > 1), 'Machine'[Duration])

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂 (Hit the thumbs up button!)
If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)


https://www.vivran.in/

Connect on LinkedIn

View solution in original post

mahoneypat
Employee
Employee

If your column was type Duration in the query editor, it was converted to a decimal value (in days) when loaded.  You can use a measure expression like this to filter out durations <1 sec.

 

NewMeasure = CALCULATION(SUM(Table[Duration]), Table[Duration] > 1/(24*60*60))

 

For more about modelling and "measure"-ing time/durations, please see these videos.

(4) It's About Time - Part One - YouTube

(4) It's About Time - Part Two - YouTube

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

5 REPLIES 5
mahoneypat
Employee
Employee

If your column was type Duration in the query editor, it was converted to a decimal value (in days) when loaded.  You can use a measure expression like this to filter out durations <1 sec.

 

NewMeasure = CALCULATION(SUM(Table[Duration]), Table[Duration] > 1/(24*60*60))

 

For more about modelling and "measure"-ing time/durations, please see these videos.

(4) It's About Time - Part One - YouTube

(4) It's About Time - Part Two - YouTube

 

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


@mahoneypat , thanks for the "duration type" solution. 

Applicable88
Impactful Individual
Impactful Individual

Hi @vivran22 thank you very much.

Is there also a way to write it with Averagex, in case I want to iterate.

Best. 

@Applicable88  Yes, you can.

 

AVERAGEX(FILTER('Machine', 'Machine'[Duration] > 1), 'Machine'[Duration])

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂 (Hit the thumbs up button!)
If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)


https://www.vivran.in/

Connect on LinkedIn

vivran22
Community Champion
Community Champion

Hello @Applicable88 

 

You may try add a filter to your CALCULATE statement:

CALCULATE(AVERAGE('Machine'[Duration]), 'Machine'[Duration] > 1)

 

Cheers!
Vivek

If it helps, please mark it as a solution
Kudos would be a cherry on the top 🙂 (Hit the thumbs up button!)
If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)


https://www.vivran.in/

Connect on LinkedIn

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.