Wrong order of week days, months, etc...

  • Hi,

    I defined two columns in DSV:

    DatePart(dw, reporting_date) -- for week day key

    CASE DatePart(dw, reporting_date) -- for week day name

             WHEN 1 THEN 'Monday'

             WHEN 2 THEN 'Tuesday'

             WHEN 3 THEN 'Wednesday'

             WHEN 4 THEN 'Thursday'

             WHEN 5 THEN 'Friday'

             WHEN 6 THEN 'Saturday'

             WHEN 7 THEN 'Sunday'

          END

    I put two attributes from these columns into the dimension.  When I build the dimension I get the wrong order of my week days: [Friday, Monday, etc] instead of [Monday, Tuesday, etc].  I tried to set different ordering in the attribute properties: key, name, attribute key, attribute name, but nothing changed.  Am I looking in the wrong place.

    Thanks.

     

  • Check your Key and Name columns for the DOW attribute you've created to ensure that the key is set to the integer field and the name to the dayname.  If this is set then setting the orderby to be the 'Key' should order your attributes correctly.  Did you reprocess the dimension after making the change?  And if so, did you check the processing type (go for full just to be sure).

     

    Steve.

  • I would like to see another one named query field

    If it is like this....

    CASE DatePart(dw, reporting_date) -- for week day name

             WHEN 1 THEN '1'

             WHEN 2 THEN '2'

             WHEN 3 THEN '3'

             WHEN 4 THEN '4'

             WHEN 5 THEN '5'

             WHEN 6 THEN '6'

             WHEN 7 THEN '7'

          END

    ......Then replace with

    CONVERT(TINYINT,(CASE DatePart(dw, reporting_date) -- for week day name

             WHEN 1 THEN 1

             WHEN 2 THEN 2

             WHEN 3 THEN 3

             WHEN 4 THEN 4

             WHEN 5 THEN 5

             WHEN 6 THEN 6

             WHEN 7 THEN 7

          END))

    BHUDEV PRAKASH

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply