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
mrjackoo
Frequent Visitor

Cumulative average of duration last 10days

Dear all,
I have to calculate the Average duration of execution of the packages over the last ten days (with status "OK"), I tried a lot but it still not working. 

For example, if I select the row of the PKG1 which run the 01/01/2017, I must calculate the average (of execution of this package) between the 23/12/2018 and the 01/01/2017.
In the end, we should get a table that shows both OK and KO pkgs a
nd we should be able to filter the report by date, folder, project, package and status ( with five differents slicers)

Any help is greatly appreciated, Thank you.

data.PNG

4 REPLIES 4
Greg_Deckler
Super User
Super User

So, it is going to look something along the lines of:

 

Measure = 
VAR currentDate = MAX('Table'[Start-time])
VAR tmpTable = CALCULATETABLE('Table',[Start-time]<=currentDate && [Start-time]>=(currentDate-10)
RETURN AVERAGEX(tmpTable,[Duration])

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Thank you for your reply,
I modified your measure,I thought it works but after performing some tests I noticed that the measure changes by changing the name of the package . A filter is missing on the package name !! Any ideas ?
Measure =
VAR currentDate = MAX('Table'[start_time])
VAR tmpTable = CALCULATETABLE(Table
                             ;FILTER(ALLSELECTED('Table');'Table'[status] ="ok")
                            ;'Table'[start_time] <=  currentDate && 'Table'[start_time]>=(currentDate-10))
                    
RETURN CALCULATE(AVERAGEX(tmpTable;'Table'[Duration]))

 

 

 

Tough to trouble shoot, can you post your data in a form that can be copied or post your PBIX file?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Please find this link for the data . thank you again for your attention.
https://drive.google.com/open?id=107E5KNX_DEAObhIfWAPPA6055OTj9SNb

 
As you can see we have several events by package execution, we just need to analyse the KPI at package level, we do not need to drill down to the event.

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.