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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
pripatel2787
Frequent Visitor

Average time taken in last 7/14/30/90/365 days

Hi,

 

I am trying to calculate how long it has taken to approve/reject work orders in the last 7/14/30/90/365 days in power bi to show something like this:

e.g. in the last 7 days it has taken an everage of 3 days to approve/reject works relating to Autodoors.

pripatel2787_0-1710514776727.png

The 7/14/30/90/365 dates would need to be based of the latest 'date created' in the data table

 

my data table has these headers:

 

pripatel2787_1-1710515491528.png

is this possible?

Thanks

 

 

1 ACCEPTED SOLUTION

You could do that, or you could have a reference table with the date ranges and then use a single measure.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

View solution in original post

6 REPLIES 6
pripatel2787
Frequent Visitor

Thanks - i have used dummy data - is this table ok?

Work Request NumberAsset SubcategoryWR Created DateDays to Approve/Reject
214174Electrical Installation Condition Report10 Aug 23182
217732Electrical Installation Condition Report3 Jul 231
226457Autodoors20 Apr 230
206910L8 Water Check (M&E)20 Dec 232
211657L8 Water Check (M&E)27 Sep 236
206126Electrical Installation Condition Report15 Jan 248
239639Electrical Installation Condition Report29 Nov 2298
233239Electrical Installation Condition Report15 Mar 232
211864Gas Safety Test22 Sep 2311
216448Autodoors17 Jul 233
238181Autodoors8 Feb 2327
231165Autodoors28 Mar 237
237634Autodoors14 Feb 2321
218670Autodoors28 Jun 231
235375Mortuary Trolley1 Mar 238
224794Mortuary Trolley1 May 233
224038Hydraulic Mortuary Trolley5 May 235
206563Autodoors2 Jan 2421
199013Autodoors22 Feb 244
198068Autodoors26 Feb 241
229500L8 Water Check (M&E)5 Apr 2329
227456L8 Water Check (M&E)17 Apr 2317
211301Electrical Installation Condition Report4 Oct 239
210173Electrical Installation Condition Report31 Oct 233
207646Autodoors11 Dec 2359
226641L8 Water Check (M&E)20 Apr 2313
227153L8 Water Check (M&E)18 Apr 2315
210903Electrical Installation Condition Report13 Oct 230
216063Electrical Installation Condition Report19 Jul 230
214532Electrical Installation Condition Report2 Aug 235
222217Gas Safety Test19 May 233
207901Autodoors4 Dec 230
199417Autodoors21 Feb 245
205656Autodoors24 Jan 245
206847Autodoors21 Dec 2318
199617Autodoors19 Feb 247
238429Mortuary Trolley7 Feb 2328
238622Mortuary Trolley3 Feb 2332
210727Electrical Installation Condition Report16 Oct 2318
213015Electrical Installation Condition Report4 Sep 23126
213931Electrical Installation Condition Report15 Aug 2370
212693Electrical Installation Condition Report7 Sep 2329
207679Autodoors6 Dec 2316
213030Electrical Installation Condition Report1 Sep 230
233292Lifting Equipment and Fall Arrest Systems15 Mar 232
235799Lifting Equipment and Fall Arrest Systems27 Feb 2398
216265Electrical Installation Condition Report18 Jul 2348
213066Electrical Installation Condition Report31 Aug 234
211642Electrical Installation Condition Report27 Sep 2313
223660Hydraulic Mortuary Trolley9 May 231
207708Autodoors6 Dec 2333
219976Fire Alarm Systems13 Jun 231
207624Autodoors11 Dec 2328
240258Refrigerant Gas Compliance17 Nov 22110
239111Passenger Lift25 Jan 2341
232273Lifting Equipment and Fall Arrest Systems23 Mar 2312

lbendlin_0-1710540631990.png

see attached

 

lbendlin
Super User
Super User

yes, that seems to be very doable. What have you tried and where are you stuck?

Hi, thats great - I have started by creating measures for each of the 7/14/30/90/365 days:

 

SevenDayRollingAvg =
AVERAGEX(
    DATESINPERIOD(Closed[WR Created Date].[Date], LASTDATE(Closed[WR Created Date].[Date]), -7, DAY),
    CALCULATE(SUM(Closed[Days to Approve/Reject]))
)
 
but this just give me blanks

You could do that, or you could have a reference table with the date ranges and then use a single measure.

 

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).

Do not include sensitive information or anything not related to the issue or question.

If you are unsure how to upload data please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...

Please show the expected outcome based on the sample data you provided.

Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Thanks a lot! This is spot on! 👍

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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