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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
FredLEGUEN
Helper III
Helper III

Result last 90 days vs Result between 90 and 180 days

Hi,

 

I have a table with the number of days to resolve a ticket (Date close ticket - Date open ticket)

I want to calculate the average number of days for the last 90 days.

I have tried with DATESINPERIOD([Date],MAX([Date],-90,DAY)

Also PARALLELPERIOD([Date],0,QUARTER)

But none of these techinique return what I want

 

And also, how do you return the result for the range between -90 days and -180 days?

 

Thanks

1 ACCEPTED SOLUTION
mangaus1111
Solution Sage
Solution Sage

Hi @Surya9 ,

 

if you use this sample model

 

Screenshot 2022-10-10 165249.png 

 

and the following measures:

 

Avg Days = AVERAGE(DaysforTicket[DayforTicket])
 
Avg Last 90 Days =
VAR MaxDate = MAX('DaysforTicket'[Date])
RETURN
CALCULATE([Avg Days],
          'DaysforTicket'[Date]<= MaxDate && 'DaysforTicket'[Date] > MaxDate -91
)
 
Avg Last 90-180 Days =
VAR MaxDate = MAX('DaysforTicket'[Date])
RETURN
CALCULATE([Avg Days],
          'DaysforTicket'[Date]<= MaxDate -90 && 'DaysforTicket'[Date] > MaxDate -180
)

 

you can get the following result:

 

 

mangaus1111_0-1665413700781.png

 

View solution in original post

5 REPLIES 5
mangaus1111
Solution Sage
Solution Sage

Please hit the thumbs up & mark it as a solution if it helps you. Thanks.

mangaus1111
Solution Sage
Solution Sage

Hi @Surya9 ,

 

if you use this sample model

 

Screenshot 2022-10-10 165249.png 

 

and the following measures:

 

Avg Days = AVERAGE(DaysforTicket[DayforTicket])
 
Avg Last 90 Days =
VAR MaxDate = MAX('DaysforTicket'[Date])
RETURN
CALCULATE([Avg Days],
          'DaysforTicket'[Date]<= MaxDate && 'DaysforTicket'[Date] > MaxDate -91
)
 
Avg Last 90-180 Days =
VAR MaxDate = MAX('DaysforTicket'[Date])
RETURN
CALCULATE([Avg Days],
          'DaysforTicket'[Date]<= MaxDate -90 && 'DaysforTicket'[Date] > MaxDate -180
)

 

you can get the following result:

 

 

mangaus1111_0-1665413700781.png

 

v-yanjiang-msft
Community Support
Community Support

Hi @FredLEGUEN ,

Is your problem solved? If so, would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirment will find the solution quickly and benefit here, thank you!

Best Regards,
Community Support Team _ kalyj

Hi,

In fact, no, the solution didn't solve my problem. This is why I didn't reply

Surya9
Helper V
Helper V

With in your measure use below measure 

FILTER(ALL('Date'),[Date] >=startdt && [Date] <= enddt)
where startdt and and enddt will change based on the criteria 
0-90 days or 91 - 180 days

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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