Join With Date Dimension

Hi,
I have one Dimension called Caseheader and Date Dimension. In Date dimension I have date key  yyyymmdd format. I have fact table in which i am getting CaseCreationDate from Caseheader Dimension. in case creationdate it contains time as well because
there is a requirement to do some reports based on timing.
When I join case creationdate to date column in a data source view with date dimension i do not get any thing  and get error in cube processing as well because it does not match with case creationdate because of time. What is the best possible approach
to resolve this issue? Do I need to add time dimension? or have a time field in date dimension?
Could anyone suggest please?
MH

Thanks Christian, I have separated date and time and kept the original field with datetime as well in case if somebody wants it for reporting purpose. Thank you so much for all your help suggestions. Much appreciated. Used this code
convert(date,ch.CaseCreationDate)asCaseCreationDate
,convert(varchar(8),convert(time,ch.CaseCreationDate))as[CaseCreationTime]
Regards,
Mustafa
MH

Similar Messages

  • Inner join with data also from non having join column

    I have an Dim table which has to be joined with Fact Table using inner join, but also display the Dimension value " MasterGroup " inspite of data present or not in the fact table.
    My Query:  .. This is an part of my stored procedure with more tables
    SELECT a.SalesAmount, b.HeaderGroup ,c.CityName
    FROM dbo.FactItem a
    inner join dbo.[DimHeader] b
    on a.sid = b.sid
    left join dbo.DimCity c
    on a.cityid = c.id
    My DimHeader Table will have data like
    MasterGroup
    ChildGroup
    etc...
    which is an attribute.
    There might not be any relevent fact data, but still i want the dimension data to display the "MasterGroup"
    ShanmugaRaj

    hello ,
    usually this is not possible when the column you want to display when the matches not found from a table having a distinct values which are hard to declared static..
    you can incorporate something like this if you cant change the join type ..
    select distinct HeaderGroup from dbo.[DimHeader] tbl_outerleft join (SELECT a.sid,a.SalesAmount, b.HeaderGroup ,c.CityName
    FROM dbo.FactItem a
    inner join dbo.[DimHeader] b
    on a.sid = b.sid
    left join dbo.DimCity c
    on a.cityid = c.id) tbl_Main on tbl_Main.sid =tbl_outer.sid
    Dilip Patil..

  • Problem with outer join with filter on join column

    Hi,
    In physical layer I have one dimension and two facts, and there's an outer join between the facts.
    dim_DATE ,
    fact_1 ,
    fact_2
    Joins:
    dim_DATE inner join fact_1 on dim_DATE.DATE = fact_1.DATE
    fact_1 left outer join fact_2 on fact_1.DATE = fact_2.DATE and fact_1.SOME_ID = fact_2.SOME_ID
    When I run a report with a date as a filter, OBIEE executes "optimized" physical SQL:
    select fact1.X, fact2.Y
    from
    Fact_1 left outer join on fact_1.DATE = fact_2.DATE and fact_1.SOME_ID = fact_2.SOME_ID
    where Fact_1.DATE = TO_DATE('2009-05-28' , 'YYYY-MM-DD' )
    and  Fact_2.DATE = TO_DATE('2009-05-28' , 'YYYY-MM-DD')
    The filter on Fact_2.DATE effectively replaces outer join with inner.
    Is there a way to disable this "optimization", which is actually very good for inner joins, but doesn't allow outer joins?
    Thanks in advance,
    Alex
    Edited by: AM_1 on Aug 11, 2009 8:20 AM

    If you want to perform a Fact-based partitioning with OBIEE (two fact with the same dimension), you have to :
    * create in your physical layer for each fact table the joins with the dimension
    * create in the Business Model layer ONE star schema with ONE logical fact table containing the columns of your two physical fact table
    In this way when you choose minimal one column of your fact1 and one column of your fact2, OBIEE will perform two query against each fact table/dimension, join them with an OUTER JOIN and your problem will disappear.
    Cheers
    Nico

  • Duplicate attribute key in date Dimension

    Hi,
    I have created a date dimension using this code
    http://www.codeproject.com/Articles/647950/Create-and-Populate-Date-Dimension-for-Data-Wareho
    It contains one attribute 'Month'
    I have created one fact table which contains the following dates
    StartDate
    EndDate
    CreationDate
    CompletionDate
    AssignedDate
    ReceivedDate
    ActualStartDate
    AcutualEndDate
    DecisionDate
    I have created a relationship with date dimension created by using above code. Relationship of above attributes have been created with DimDate.Date attribute. I have not created Calendar Hierarchy yet. 
    When I am processing the cube I am getting the following error
    Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'dim_Date', Column: 'Month', Value: '10'. The attribute is 'Month'.
    In date dimension have data from 1990 to 2050. so Month is being repeated for each year. I am not sure Why am I getting this error.
    Any Help much appreciated.
    MH

    Hi Mustafah,
    For the error "Errors in the OLAP storage engine: A duplicate attribute key has been found when rocessing: Table: <tablename>, Column: <columnname>. Value: <value>. The attribute is <attributename>", it  can occur in multiple
    situations. In many cases, the recommended solution is to change the KeyColumn by setting it to a unique attribute, or by creating a composite key that results in a unique value when multiple attributes are evaluated as a unit. Here are some document which
    describe this error and the solution of it.
    References:
    Analysis Services: Errors in the OLAP storage engine:
    A duplicate attribute key has been found when processing
    You get “A duplicate attribute key has been found when processing ..” error message when processing a dimension
    A duplicate attribute key has been found when processing
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • Join fact table with higher dimension level

    how do i join fact tables with higher dimension levels with discoverer?
    fact with detail at level C
    measure X
    dimension with
    D->C->B->A
    E->C
    level
    A B C
    1------1------1
    2------2------1
    3------2------1
    join between fact X and dimension level C
    X=3*C because of sum(X) in discoverer and 3xC in dimension
    is there a way to get correct values for X without creating a dimension like
    D->C
    E->

    another way of asking this is whether you can create a summary table in Discoverer at a higher level than a dimension's fundamental grain. In other words - the summary examples in the documentation all describe leaving out one or more of your dimensions... they are either left in or completely taken out. But, some of the most effective summarization occurs when you summarize daily data to a monthly level. Assuming that I have a sales table (at a daily level, and a key value sales_date), and a table date_dim (primary key sales_date), I would like to create a summary sales_month_summary where the sales are grouped on month_year (which is a field in the sales_date table).
    How is this done? I suspect that we can't use the date_dim table with the summary (due to the problems noted by the poster above). Do we have to create another table "month_dim"? Do we have to fold all of the desired date attributes (month, quarter, year) into the summary? Obviously we'd like to re-use all of the pertinent already existing date items (quarter, month, year, etc.), not recreate them over again, which would result in essentially two sets of items in the EUL. [One used for this month summary, and another used for the detail.]
    I searched the forum - someone asked this same question back in 2000 - there was no answer provided.
    The only other thought I have is to "snowflake" the date_dim into two tables and two folders, one at a date level, another at the month level. Then the detail tables can connect to date_dim (which is linked to month_dim), while the summary data can connect directly to month_dim.

  • Joining two fact tables with different dimensions into single logical table

    Hi Gurus,
    I try to accomplish in Oracle Business Intelligence 11.1.1.3.0:
    F1 (D1, D2 and D3)
    F2 (D1 and D2 and D4)
    And we want to build a report F1 F2 D1 D2 D3 D4 to have data for:
    F1 that match only for D1-D2-D3
    and data for
    F2 that match only D1-D2-D4
    all that in one row, so D3 and D4 are not common dimensions.
    I can only do:
    F3 (D1, D2)
    F4 (D1, D2 and D4)
    And report
    F3 F4 D1,D2,D4 (all that in one row, and only D4 is not a common dimension)
    Here is the very good example how to accomplish the scenario 1
    http://108obiee.blogspot.com/2009/08/joining-two-fact-tables-with-different.html
    But looks like it does not work in 11.1.1.3.0
    I get
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 14025] No fact table exists at the requested level of detail: [,,Clients,,Day,ROI,,,,EW_Names,,,,,,,,,,,,,,,,,]. (HY000)
    I am sure I set up everything correctly as advised in the blog but it works with only one not a common dimension
    Is it a bug in 11.1.1.3.0 or something?
    Thanks,
    Kate

    Thanks for all your replies.
    Actually, I've tried the solutions you guys mentioned. Generally speaking, the result should be displayed. However, my scenario is a little bit tricky.
    table Y's figures are not the aggregation of table X for D dimension. Instead, table Y's figures include not only D dimension total, but also others (others do not mean A, B, C dimension). For example, table Y stores all food's figure, while table X stores only drink's figure. D dimension is only about drink's detail. In my scenario, other foods' figure is not provided.
    So, even if I set D dimension to all/total for table X, table X's result is still not the same as table Y.
    Indeed, table Y does not have a column key to join to D dimension's key. So, if I select D dimension and table Y's measures at the same time in BI Answer, result returns no data. Hence, I can't compare table X and table Y's results with selection of D dimension.
    Is there any solution to solve this problem?
    Edited by: TomChan on Jun 3, 2009 9:36 AM

  • Logical fact table with fragmented data sources with different dimensions

    Hello.
    I have a logical fact table with four logical table sources. Three of the LTS's share the same dimensions, but the fourth LTS has one dimension (called Dim_A) less. In the physical layer the dimension Dim_A is joined to the first three physical fact tables, but not to the fourth fact table (since it doesn't have that dimensionality). In the BMM layer the logical fact table is joines to the logical dimansion Dim_A.
    When I run an analysis on this RPD the measures from the logical fact is aggregated correctly (union of all four table sources) as long as I doesn't include Dim_A, but as soon as I include dimension Dim_A I get the error message:
    +State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 43119] Query Failed: [nQSError: 14052] Internal Error: Logical column Dim_A.Column_X has no physical sources that can be joined to the physical fact table source [Logical table sources (Priority=0): Fact_B.Fact_Y]. (HY000)+
    I would like a solution where the analysis returns correctly aggregated measures also for the LTS with the "missing" dimension, but with a dimension value NULL for this LTS. Or something like this.
    Is there a way to set this up in the RPD.
    Thanks,
    Henning Eriksen

    The SQL could look something like this.
    SELECT dim_a.col_1, fact_a.measure_1
    FROM db.dim_a
    JOIN
    db.fact_a
    ON fact_a.col_2 = dim_a.col_2
    WHERE fact_a.date = '28-nov-2012'
    UNION ALL
    SELECT dim_a.col_1, SUM (fact_b.measure_1)
    FROM db.dim_a
    JOIN
    db.fact_b
    ON fact_b.col_2 = dim_a.col_2
    WHERE fact_b.date = '28-nov-2012'
    UNION ALL
    SELECT dim_a.col_1, SUM (fact_c.measure_1)
    FROM db.dim_a
    JOIN
    db.fact_c
    ON fact_c.col_2 = dim_a.col_2
    WHERE fact_c.date = '28-nov-2012'
    UNION ALL
    SELECT NULL, SUM (fact_d.measure_1)
    FROM    db.fact_d
    WHERE fact_d.date = '28-nov-2012'
    I would appreciate if you could give me some hints for the RPD.
    Thanks,
    Henning

  • Cartesian join on 2 dimension tables, with count aggregation?

    Hi, I have 2 dimension tables, Students, and Subjects, and a fact table, Marks. (simplified)
    the Students and Subjects dimension tables both have a 1-N relationship with Marks, so reporting works fine.
    However, there are some students who does not have a score in a certain Subject, so when I generate the report of each Subject's scores by Student it'll be
    Subject Students Marks
    English A 89
    ......... C 70
    ......... D 60
    Maths B 30
    ......... C 80
    because Students and Subjects are joined by the Marks table
    What I'd like to see is
    Subject Students Marks
    English A 89
    ......... B 0
    ......... C 70
    ......... D 60
    Maths A 0
    ......... B 30
    ......... C 80
    ......... D 0
    The joins between the dimension and fact tables are all set to "Left-outer join" (where "left" is the dimension table)
    I thought I needed a cartesian/cross join on Subjects and Students, using the dummy table technique here: http://gerardnico.com/wiki/dat/obiee/densification_repository#the_cross_join_between_the_dimensions
    But it didn't work, not to mention that I have a feeling that this doesn't really apply to 10g or my problem.
    Can someone point me in the right direction on this? Thanks!
    Above problem solved, but I also need a column of "Count of students who scored 50 or less" which includes the students who did not have any scores. Adding the dummy column to my report breaks the aggregation in my report, while removing the column will take me back to square one.
    How do I generate a report that does aggregation that takes into account the students with no scores?
    Edited by: lum on 28-Mar-2012 20:13

    Here's what I did:
    I created the physical table with 1 column, and did a complex join with expression "1=1" on the 2 tables that my actual fact table was directly joined to (and none of the indirect joins). I'm using 11g, so to do complex joins I had to use Manage->Joins
    Then I added the dummy column to my Marks fact table in the BMM layer by just dragging it and set the aggregation rule. And then to the presentation layer too.
    After updating the repository onto the server, the table behaviour is still the same as before, and the dummy column didn't do anything and displayed a blank value.
    Could it be because of my other joins that make this dummy join not work? I don't even know if this 1=1 complex join work in 11g....!
    Has anyone tried this join technique in 11g? Thanks!
    PS: My dimension table and fact tables are actually logical tables that join several tables at the logical table source layer. My dummy fact table just joins the most detailed layer of the physical dimension tables.

  • Issues with using Outer join in Data Template

    Hi all,
    this is my data in two tables .
    Table Ronny1
    colA colB
    1 u
    2 v
    3 x
    Table Ronny2
    colC colD
    1 q
    2 r
    This is my data template
    <dataTemplate name="MGF" dataSourceRef="Source1">
         <dataQuery>
              <sqlStatement name="Q1" dataSourceRef="Source1">
                   <![CDATA[select C, D  from Ronny2]]>
              </sqlStatement>
              <sqlStatement name="Q2" dataSourceRef="Source2">
                   <![CDATA[select A , B from lokesh1 where A = :C]]>
              </sqlStatement>
         </dataQuery>
         <dataStructure>
              <group name="G1" source="Q1">
                   <group name="G2" source="Q2">
                        <element name="A" value="A"/>
                        <element name="B" value="B"/>
                   </group>
              </group>
         </dataStructure>
    </dataTemplate>
    Now this would give me result as
    A B
    1 u
    2 v
    however my requirement is this
    A B
    1 u
    2 v
    3 x
    that is, i want to display all the rows of table Ronny1 and matching rows from table Ronny2. I tried modifiying my second sql as
    <![CDATA[select A , B from lokesh1 where A = :C (+)]]> ( using a outer join)
    but this does give me correct data and comes back with the cartesion product.
    Can anyone please answer this for me that how can we use the outer join in data templaes.
    Thanks
    Ronny

    hey vetsrini,
    sorry for the confusion here,
    actually i want to display all the rows from table Ronny1 and i am also pulling in the matching rows from table Ronny2 and my data structure looks as ( pulling in column D from table Ronny2)
    <dataStructure>
    <group name="G1" source="Q1">
    <group name="G2" source="Q2">
    <element name="A" value="A"/>
    <element name="B" value="B"/>
    <element name="D" value="D"/>
    </group>
    </group>
    </dataStructure>
    and this is what i want the output to be
    A B D
    1 u q
    2 v r
    3 x
    Hence the row where A <> C the data in the D column will be null, same as in the case of outer join.
    any suggestions
    Thx
    Ronny

  • How to tune performance of a cube with multiple date dimension?

    Hi, 
    I have a cube where I have a measure. Now for a turn time report I am taking the date difference of two dates and taking the average, max and min of the date difference. The graph is taking long time to load. I am using Telerik report controls. 
    Is there any way to tune up the cube performance with multiple date dimension to it? What are the key rules and beset practices for a cube to perform well? 
    Thanks, 
    Amit

    Hi amit2015,
    According to your description, you want to improve the performance of a SSAS cube with multiple date dimension. Right?
    In Analysis Services, there are many tips to improve the performance of a cube. In this scenario, I suggest you only keep one dimension, and only include the column which are required for your calculation. Please refer to "dimension design" in
    the link below:
    http://www.mssqltips.com/sqlservertip/2567/ssas--best-practices-and-performance-optimization--part-3-of-4/
    If you have any question, please feel free to ask.
    Simon Hou
    TechNet Community Support

  • Problem while adding a new dimension in a existing cube with data in BW3.5

    Hi,
    We are trying to create a new dimension with new characteristics in a existing cube. But while activating we are getting error that "InfoCube contains data; intentional changes not permitted". Can we add a new dimension in a existing cube with data in BW3.5? If it is not possible then we can take the backup and delete the data from cube and then change the cube. But my question is that, when we will transport the cube with changes to quality then will it transport successfully or same procedure needs to be done there as well.
    Regards,
    Saikat

    hi,
    Adding new infoobject /dimension to the cube containing data in 3.5 is not possible.
    easier solution is create a new cube similar to old and add the new dimension and proceed.
    else you have to drop data and transport.
    Ramesh

  • Pie chart with two measures and date dimension navigation not working

    Hi Experts,
    Pie chart with two measures and date dimension navigation not working. Any help is appreciated.
    Thanks
    V

    Hi Deepak,
    I had time dimension in the RPD.
    I have stacked bar chart with same time dim like year & month in the report. when I go to legand and set navigation it is working fine. But not with pie chart.
    I am not not sure what is the problem. When I click on Pie chart it is not navigating to the target report. Can it be any other issues..???

  • Problem populating date dimension with correct values

    Hi all,
    I have a 'simple' problem, but can't get it solved! The YTD calculations in the cube don't 'reset' at the right moment in time (they should 'reset' on the FISCAL year, but it actually seems to happen on the normal calendar year).
    Our dimensions and cubes are MOLAP. There is a relational table, containing columns with values for both a CALendar hierarchy as well as for a FISCAL year hierarchy. This table populates the date dimension (only the fiscal hierarchy as in MOLAP we only have a fiscal hierarchy). The result looks correct in the data viewer.
    The cube is populated from relational sources as well. One view provides the measure values and the CODE (business identifiers) values for each dimension involved. In case of the date dimension, it provides the code value for the involved level at which we load the cube (month).
    I made a very simple testcase with only 1 dimension (date) and 1 small cube. The cube uses only the date dimesion (to load cube on the fiscal hierarchy at month level) and has 1 base measure that is loaded with a simple number and 1 calculated measure that calculates the YTD value for this base measure. The calculated measure is added in the OWB cube designer using button "Generate Calculated Measures" and choosing the "Year to Date" function.
    When populating the cube and using the data viewer to check the results, the YTD measure values don't 'reset' at the fiscal year end. They seem to reset at the normal CALendar year end!?
    After some testing, I have concluded it has to do with the values I supply to populate the date dimension, but I can't figure out what the modification should be and I can't find any examples anywhere.
    Does anyone out there have a working YTD calculation in MOLAP?
    Any help much appreciated.
    Regards,
    Ed

    Sorry David, I am not sure I've got this right yet. I am looking at using the cumsum function, but I am not sure how to apply this. That is, I can see examples (cumsum(measure, total_dim, reset_dim)), but I think I cannot put such formula directly into the expression editor for a cube measure in OWB?
    Until now I have been using the standard available calculated measures in the OWB measure editor and I think they insert an xml template? I'll get the Excel Calculation Tool from OTN, to see if I can create the correct formula and paste that in OWB in the expression editor for the measure. (Does that tool need a ROLAP workspace or does it need / can it work with a MOLAP workspace?)
    Thanks and regards,
    Ed
    Edited by: EdSp on Jan 13, 2009 1:57 PM
    I have downloaded the Excel sheet and can see how it works, but it seems to "insert" the calculated measures straight into the AW. However we deploy the AW from OWB so I will be looking at getting something to enter/paste in the expression editor of OWB...

  • BOXIR2 FP4.6 -WebI report with merged dimensions: Incorrect data

    Issue: BOXIR2 FP 4.6 -WebI report with merged dimensions: Max value of an object from second query is displayed in the report even when the formula is based on the object from the first Query.
    Data displays properly on BOXIR2 SP2.
    Steps to reproduce.
    1.Use u2018Island Resort Marketingu2019 Universe to create a WebI report.
    2. Create a Query with objects u2018Reservation Dateu2019 and u2018Future guestsu2019 and apply a query filter where the u2018Reservation Dateu2019 is between 1/1/2001 and 31/1/2001 an Run the query.
    3. Add a second Query with the same objects i.e. u2018Reservation Dateu2019 and u2018Future guestsu2019 and apply a query filter where the u2018Reservation Dateu2019 is between 1/1/2001 and 31/12/2001.
    4. Create a report variable MaxDate using the syntax "=Max([Query 1].[Reservation Date]) In Report"
    5. Use the objects u2018Reservation Date Query 2u2019, u2018Future guests Query 2u2019 and u2018MaxDateu2019 variable to create a table in the report.
    You will find the Maxdate column displays Max date values of u2018Reservation Date Query 2u2019 instead of u2018Reservation Date Query 1u2019.
    Could you please advice me on this issue.

    Hi Hiteshwar,
    MaxDate variable returns a maximum of Reservation date  from Query 1 i.e. 1/15/01 which is correct. If you put that variable separately it will display that date correctly but you are grouping it along with objects from the query2 thatu2019s why it is displaying correct value for Query 2 where it finds 1/15/01, but for other values WEBI canu2019t group this value as it refers its formula which contains Query 1 reservation date.
    Hence we canu2019t say it is displaying values from Query 2 it is taking values from Query1 itself  for 1/15/2001 and for remaining values it is taking non matching values from Query 2 with which it is grouping.
    If you put that variable with objects from Query1 it wonu2019t display 1/15/01 but all values reservation date from query 1 contains because it is grouping based on reservation date though it is single max value.
    Even when you write "=Max(Query 2.Reservation Date) formula and use it with objects from query 1 though it contains so many values it matches (Groups) only the values from reservation date from Query 1.and displays only those values i.e. 1/1/2001 and 1/15/01.
    MaxDate returns 1/15/01 as Maximum Date value from Query 1 but Query 2 contains value far more greater than 1/15/01 hense that will be more incorrect data if WEBI displays maxdate as 1/15/01 along with Query 2 objects.
    Here we can avoid this behavior by Custom SQL but MaxDate is a report level variable hence we canu2019t edit SQL.
    If your data contains some duplicate values WEBI will repeat MaxDate value like
    Reservation date     Restaurant           Future_Guests    Total Guests 
    1/1/01                          ABC                         3                   3     
    1/15/01                       XYZ                          4                   8    
    1/16/01                       XYZ                          4                   8  
    By default, WEBI Groups Total Guests based on the Restaurant and Reservation Date, but if we want we can group those values based only on Restaurant which will duplicate Total Guest values for Restaurant XYZ. But you report contains only one dimension with all unique Values we canu2019t group those.
    I hope this is clear.
    Thanksu2026
    Pratik

  • Outer join with effective date in peoplesoft query

    Hi,
    I'm trying to join two tables using outer join. Both tables are effective dated:
    Dept_Tbl: dept_id, status, effdt
    Tips_Tbl: dept_id, tips_id, effdt
    Not all records in Dept_Tbl are in Tips_Tbl. I need to get all active depts and their most recent tips_id if they have one.
    select a.dept_id, b.tips_id
    from dept_tbl a, tips_tbl b
    where a.status = 'Active'
    and a.effdt =
    (select max(a_ed.effdt) from dept_tbl a_ed
    where a.dept_id = a_ed.dept_id
    and a_ed.effdt <= SYSDATE)
    and b.dept_id(+) = a.dept_id
    and b.effdt =
    (select max(b_ed.effdt) from tips_tbl b_ed
    where b.dept_id = b_ed.dept_id
    and b.tips_id = b_ed.tips_id
    and b_ed.effdt <= SYSDATE)
    The query only returns records that are in both tables.
    Is there a way for outer join to work with effective dates?
    Thanks in advance,
    Reg

    Here is an example of one solution. Note the use of NVL on both sides of the equal sign since both sides could be NULL in the case of the outer join
    with dept_tbl as (select 1 dept_id, SYSDATE effdt FROM DUAL),
         tips_tbl as (select 1 dept_id, NULL effdt FROM DUAL)
    select a.effdt
      from dept_tbl a,
           tips_tbl b
    where b.dept_id(+) = a.dept_id
       and NVL(b.effdt, SYSDATE) = NVL((select max(b_ed.effdt)
                                          from tips_tbl b_ed
                                         where b.dept_id = b_ed.dept_id
                                           and b_ed.effdt <= SYSDATE), SYSDATE);
    EFFDT
    5/7/2007 3:25:00 PM

Maybe you are looking for