Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Convertion of WID column to date column in BMM layer

Received Response
51
Views
6
Comments
Rank 4 - Community Specialist

TO_DATETIME(CAST ("Oracle Data Warehouse"."Catalog"."dbo"."Dim_W_DAY_D_Common"."CAL_WEEK_START_DT_WID" AS CHAR), 'YYYY-MM-DD')

is failing with below error(screenshot). The report query generated will work in SQLDevloper if i remove distinct from the sql. Please guide me in handling this.

Basically i have an wid column (format 20160407 i.e., YYYYMMDD) need to be displayed in date format and this has to be done in RPD, because user needs it for adhoc reporting.

Untitled.jpg

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

  • Rank 8 - Analytics Strategist

    Why aren't you using the W_DAY_D date column based on the lookup from the WID?  Basically a simple alias of the W_DAY_D can get you the date column (it's a self-join) ; then you have no conversion to do ... conversion is clunky and slow.  Let the DB handle it in a physical join:

    "Dim_W_DAY_D_Common"."CAL_WEEK_START_DT_WID" joins to "Dim_W_DAY_D_WeekStart"."ROW_WID"   then model it from there ... and use the date in a logical column called "Week Start Date" sourced from the "Dim_W_DAY_D_WeekStart" alias.

  • Rank 6 - Analytics Lead

    +1 ++ Thomas Dodds.

    If you want go your own then column->prop->data format->Custom then ####-##-##

  • Rank 4 - Community Specialist

    Thomas has the best design idea, but to address the question you are asking (and maybe help with future issues troubleshooting SQL), I would point out that SELECT DISTINCT requires processing of all rows, to ensure a distinct result. Without DISTINCT, Oracle can just start feeding rows (the first 50 in your example) as it gets them. My guess is that somewhere after row 50, there is a WID that is not valid for the TO_DATE() function. Select MIN(CAL_WEEK_START_DT_WID) and MAX(CAL_WEEK_START_DT_WID) to look for outliers. Again, just a guess, based on it failing when you add DISTINCT.

    After that, build an alias of the DAY table and join to it, as Thomas suggested.

  • Rank 4 - Community Specialist

    This is not possible I can't educate user's to do all these steps

  • Rank 4 - Community Specialist

    Yes you are correct when I try to load more records, error appears.

    So the left solution is Thomas's one ?

  • Rank 6 - Analytics Lead

    Helan,

    Its up to you. No one is forcing you to go with a specific solution. grab whats suites you, thats it!!

    Dont forget to mark on suggestion!!

Welcome!

It looks like you're new here. Sign in or register to get started.