Tuesday, 22 October 2013

Showing different date formats

Default format for date fields is YYYY-MM-DD and that's how they appear in Hives. But if a different format is required, we have to use an expression. If it's a dimension attribute, use the level expression. Use the CONVERT function to display in the format desired.
If it's a measure (as a MAX rollup, since SUM is not possible and COUNT case is immaterial), create an additional computed measure to use the base measure. Screenshots below.

The codes for various format are here:

http://www.sql-server-helper.com/tips/date-formats.aspx

1. We will be able to set this formatting option in analytic/hive in the future.

2. The mechanism used here is SQL Server specific. The functions are different in Oracle.

Screenshots:

Default format



Measure definition






New format


.


No comments:

Post a Comment