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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
Resolver III
Resolver III

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.