cancel
Showing results for 
Search instead for 
Did you mean: 

Showing last one month data in HANA

vaibhav_rathore
Participant
0 Kudos

Hi,

I want to show last one month data from current date.

I have a date field "LOGGEDON"

I want to filter it in projection , so that the filtered data is only passed to upper level.

What are the ways to do it?

Kindly suggest.

Regards

Vaibhav

Accepted Solutions (1)

Accepted Solutions (1)

chandan_praharaj
Contributor
0 Kudos

Vaibhav,

I think I got your problem,

Kindly create a Calculated column for longdate("LOGGEDON") as CC1

then you already has Calculated created column of yours with (adddays(now(),-30)) as CC2


then compare the Expression , you will not get the error.


Regards,

Chandan

vaibhav_rathore
Participant
0 Kudos

Hi Chandan,

This time i am not getting any error and created two calculated columns:

1) L_Date:

                  "LOGGEDON"

2) Add_Date:

                    adddays(now(),-30)

Created an Expression where:

"L_Date"="Add_Date"

this time not getting any error, but while previewing the data it showing empty result, No Rows Retrieved.

Even i tried for past 60 days but no result. Although the data is there.

What could be the reason?

plz suggest

Regards

Vaibhav

chandan_praharaj
Contributor
0 Kudos

Two things here.

try to cast it as I told. longdate("LOGGEDON")

here you are trying to see data for a particular (29 Apr 2016 -30) date .  can you directly see the table has any record for that particular date??

vaibhav_rathore
Participant
0 Kudos

Chandan,

I have created the longdate for LOGGEDON.

And i am in need of past 30 days data from todays date, and it is there i have checked it.

Regards

former_member656087
Discoverer
0 Kudos

Hi,

use below expression

No need to create any calculated columns.

just use this expression

"LOGGEDON" < = date(now()) and "LOGGEDON" >= date(adddays(now(),-30))

Thanks,

Ramesh

Answers (1)

Answers (1)

SergioG_TX
Active Contributor
0 Kudos

Vaibhav,

try add_months(current_date, -1)

here is the official documentation for the add_months function

vaibhav_rathore
Participant
0 Kudos

Hi Sergio,

How can i use this one in projection filter to restrict the data for last one month only?

Regards

Vaibhav

SergioG_TX
Active Contributor
0 Kudos

put in a filter expression in a projection node so that the output from there forward is filtered out by your condition

vaibhav_rathore
Participant
0 Kudos

Hi,

I have made one calculated column named Date_Filter in Projection_1:

(adddays(now(),-30))

and used it in Expression Filter, but it is giving me error:

Cannot Compare Daydate and Integer

I have taken Date_Filter as a Date column.

Plz suggest

Regards

Vaibhav

SergioG_TX
Active Contributor
0 Kudos

add_Days function looks incorrect - do you always want to subtract 30 days even tho some months have 30 or 28 (feb) I suggest you use the add_months function as I mentioned in on my first reply ... and use current_date as opposed to now()

former_member182302
Active Contributor
0 Kudos

Adding to Sergio's points, but if you still trying to get the filter to only last 30 days (fixed). Whatever you have done is correct, it is just that in the filter expression editor, you must be comparing like this:

LOGGEDON = Date_Filter

Just ensure the data types of both these columns are same.

Regards,

Krishna Tangudu