cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help Filtering using Date Field (want data for only last 60 days)

Former Member
0 Kudos

My issue is simple, but unable to figure out a solution.

I have an attribute view with data, it also has a Date field.

My objective: is to only retrieve data for the last 60 days (ex. Date field > now() - 60))

In calculation view, I have Projection Node on top of this Attribute View. I want to force a filter (in Expression) in the Node to retrieve only data 60 days back. Problem is that the Expression in Projection Node doesn't recognize now() - I get an error. Below is a snapshot of what I attempted.

This is a huge performance issue. Right now it's getting all the data from the Attribute View, then I'm able to get last 60 days. But the goal is to only retrieve last 60 days (filter).

Is there any solution to this? Hopefully a non-sql solution.

Below is a snapshot of what I attempted.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hey guys,

This is at the Expression Filter on a Projection Node. The HANA functions is unrecognized here (now(), daysbetween), etc.). If you look at my snapshot there is no option for such functions. If I remove now() I don't get the error.  That's the issue.

Here is the error message below:

Error Message

          Internal deployment of object failed;Repository: Encountered an error in repository runtime extension;Internal Error:Create Scenario: failed aCalcEngine.createScenario(): The following errors occured: Inconsistent calculation model (34011)nDetails (Errors):n- CalculationNode (Aggregation_1) -> filter: Expression cannot be converted to query entries: Expression may not be converted to query entries;gt(unknown_type "IEDD", minus(now(), unknown_type_2 '60')).

former_member184768
Active Contributor
0 Kudos

Hi Zain,

You can use a calculated column which will derive the value for last 60 day based on now() and then use the calculated column in your filter projection.

May be the following blog will help you.

http://scn.sap.com/community/hana-in-memory/blog/2013/07/22/implementation-of-wtd-mtd-ytd-in-hana-us...

Regards,

Ravi

Former Member
0 Kudos

Hi Khan,

Try as below, I think it should work.

daysbetween("IEDD",DATE(now()))>60

Thanks

Basha.

patrickbachmann
Active Contributor
0 Kudos

Maybe try using DAYS_BETWEEN?  I'm wondering if it's because NOW function includes the time of day and your field does not.  So perhaps try this;

DAYS_BETWEEN ("IEDD", now()) > 60