Tuesday, May 17, 2011

How to find the current month and previous month in OBIEE?

Use TIMESTAMPADD and TIMESTAMPDIFF functions to find different dates.

If you want specific month then use below code in fx of column.
For current - CASE WHEN 1=0 THEN "- Project"."Project Manager" ELSE MONTHNAME(CURRENT_DATE) END
For previous - CASE WHEN 1=0 THEN "- Project"."Project Manager" ELSE MONTHNAME(TIMESTAMPDIFF(SQL_TSI_MONTH,1,CURRENT_DATE)) END

OR

For current month -> monthname(current_date)
For prev month -> MONTHNAME(TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)))

Until Next Post...Keep Smiling :)

1 comment:

  1. will the below code wors?

    (TIMESTAMPDIFF(SQL_TSI_MONTH,1,CURRENT_DATE))

    ReplyDelete