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

Excluding ranges from linest_m() + linest_b()

Liner Trend expression:

linest_m(total aggr(if(sum(PaidAmount),sum(PaidAmount)),DateOfService),DateOfService)*MonthOfService

+

linest_b(total aggr(if(sum(PaidAmount),sum(PaidAmount)),DateOfService),DateOfService)

I need to exclude the last three months from the linear trend only. How can this be done ? I've tried set analysis after the aggr function, but may be doing something wrong.

See attached example: 2017-01,2017-02, 2017-03.

Regards

1 Solution

Accepted Solutions
sunny_talwar

May be this

linest_m({<MonthOfService = {"$(='<=' & Date(AddMonths(Max(MonthOfService), -3), 'YYYY-MM'))"}>}total aggr(if(sum(PaidAmount),sum(PaidAmount)),DateOfService),DateOfService)*MonthOfService //only({1}MonthOfService)

+

linest_b({<MonthOfService = {"$(='<=' & Date(AddMonths(Max(MonthOfService), -3), 'YYYY-MM'))"}>}total aggr(if(sum(PaidAmount),sum(PaidAmount)),DateOfService),DateOfService)


Capture.PNG

View solution in original post

6 Replies
sunny_talwar

Would you be able to share a sample to test this out?

marcoyukon
Creator
Creator
Author

Yes. I've attached it to the post.

marcoyukon
Creator
Creator
Author

Hi Sunny, were you able to test it out with the attachment I sent ? Thank you.

sunny_talwar

Sorry, I forgot... checking now

sunny_talwar

May be this

linest_m({<MonthOfService = {"$(='<=' & Date(AddMonths(Max(MonthOfService), -3), 'YYYY-MM'))"}>}total aggr(if(sum(PaidAmount),sum(PaidAmount)),DateOfService),DateOfService)*MonthOfService //only({1}MonthOfService)

+

linest_b({<MonthOfService = {"$(='<=' & Date(AddMonths(Max(MonthOfService), -3), 'YYYY-MM'))"}>}total aggr(if(sum(PaidAmount),sum(PaidAmount)),DateOfService),DateOfService)


Capture.PNG

marcoyukon
Creator
Creator
Author

I was trying to apply the set to the aggregation rather than using it on the linest functions. It makes sense now.  Thank you!