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
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
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.