Display duration time as days, hours and minutes in OBIEE

How to display time split in days, hours, minutes and seconds?

Let’s say we have a Duration Time column which contains a number of seconds of duration. We would like to display it in the report as value divided into days, minutes, hours and seconds.

For example to display 20,000 seconds is 5 hours, 30 minutes and 15 seconds.

We can do that in Answers using one of two methods:

Setting Custom data Format for a column

OBIEE offers setting custom column data format masks, including one to convert numbers in seconds, minutes, hours or days into DD:HH:MM:SS format.

How to set column’s format to display duration

  1. Go to Column’s properties
  2. Go to Data Format and check Override Default Data Format
  3. Select Treat Numbers As Custom and enter Custom Numeric Format from one of the below strings:

[duration(sec)] – this part defines whether the base value is stored in seconds (sec), minutes (min), hours (hour) or days (day).

dd:hh:mm:ss – output format in days, hours, minutes in seconds. We can add [opt:] before each part to tell OBIEE to omit this value if the opt part has no value (for example the value is less than a day, then the day is omitted).

Data Conversion Format String Output
[duration(sec)][opt:dd]:hh:mm:ss Formats the total of seconds as duration. For example, a duration value of 16500.00 is displayed as 04:35:00, meaning a duration of four hours, 35 minutes, and zero seconds.opt:dd displays the number of days, but if opt has no value, it is not displayed. 

Second is the default unit of time.

[duration(min)][opt:dd]:hh:mm:ss Formats the total of minutes as duration. For example, a duration value of 275.00 is displayed as 04:35:00, meaning a duration of four hours, 35 minutes, and zero seconds.
[duration(hour)][opt:dd]:hh:mm:ss Formats the total of hours as duration.
[duration(day)][opt:dd]:hh:mm:ss Formats the total of days as duration.

The drawback of this solution is that it would display the values separated by colon, without giving the descriptions (for example 2 days 6 hours 32 minutes). If we need to add descriptions, we would need to use the other solution. Another issue may appear when exporting the report with custom data formatting to Excel, this bug is fixed since version

For reference, check Formatting Analyses, Views, and Dashboard Pages in OBIEE documentation at https://docs.oracle.com/middleware/1221/biee/BIEUG/format.htm#BIEUG1172 .

Splitting it inside the column’s formula

We can add a column formula to the column with values in seconds to split it by days, hours, minutes and seconds. That way we also can add some text.

First we need a column that contains a numeric value expressed in seconds, minutes, hours or days. We can have it already calculated in the source database or through ETL process.

If we don’t have the value calculated we can use another OBIEE function: TimestampDiff to calculate difference between two dates expressed in seconds, minutes, hours or days depending on the interval we specify.

Add total in a chart using Calculated Items in OBIEE

How to add an additional category for the total to a graph in OBIEE?

Sometimes in the requirements you need to present a breakdown of values by categories and their total on one chart. In the example below this is done for horizontal bar graph, but it can be done for any graph using the Calculated Items feature.

OBIEE Chart Example Continue reading

Edit reports starting on Criteria tab in OBIEE

How to start editing a report on Criteria tab instead of Results tab?

By default the when you click on Edit report, you OBIEE Answers opens it on the Results tab. This triggers the report’s query execution and most of the time you want to go to the Criteria tab anyway. So it can save you some time if you change your account settings to navigate directly to the Criteria tab when editing. Continue reading

Display custom message in No Results view in OBIEE

How to change or remove the No Results message in OBIEE?

When the results of an analysis return no data, the following default message is displayed to users:


We can modify the No Results view, by adding custom message or more explanation on the use of report or hints on how to filter values.  We can also change it’s visual formatting.

Continue reading

Oracle Alta UI color palette

The colors of Oracle’s new user interface

Oracle announced Alta User Interface – a new design and set of guidelines for the developers for the latest Oracle applications (cloud-based products, Fusion Middleware and mobile applications) and the next Oracle products to come. Alta UI is created as a responisve, mobile-ready, flat and clean interface designOracleAltaUI1 Continue reading

Go back to report prompts with a custom button in OBIEE

When a prompt is added to a report in OBIEE, it will ask user to provide the prompt values when the report is opened. Report results will be filtered by the values chosen by user in prompts. After that, user can’t change the report’s filtering condition as the prompts are no longer visible. To solve this, we will add  GoBackToReportPrompt04 button with a link to take the user back to prompts.

How to add Go to Prompts button to the report?

Let’s add a Static Text view in report’s results page.


Inside the Static Text view check the Contains HTML Markup box and add the following HTML code:

<button onclick="window.location.href='saw.dll?PortalGo&Action=prompt&path=%2Fshared%2FReports%2FSales' ">Go to Prompts</button>

replacing the path= parameter with the path to the report starting with forward slash / (%2F in URL encoding).


Below the Static Text field you can see the preview of the button. Add the Static Text view to report’s Compound Layout.


Now the report displays ‘Go to Prompts’ button that takes user back to prompts.


Correct order by Month date in OBIEE

How to order by month number not alphabetically by month name?

When you add a column with MON or MONTH date format in OBIEE report its values would be sorted alphabetically, not by the month number order. That way December would come before January etc. To sort by months in their correct order we need a date in a month number format (1 for January, 2 for February etc.).


There are two solutions for this:

Change in repository

To avoid such issues, a date column with Month name should have a proper sorting order. This can be done in the repository, by setting sorting order by another date column with correct order (Month Number) in a logical layer. In the logical layer click on Month column’s criteria and change the Sort order column settings to order it by Month number column (it should be available in Date dimension).


Workaround in BI Answers

There is also a workaround solution to achieve correct month order in Oracle BI Answers. To solve this, add the full date column from the same dimension, change the formula to evaluate date in YYYY-MM format.

EVALUATE('TO_CHAR(%1,%2)' AS CHARACTER (30), "Date Column", 'YYYY-MM')


Now you can add the column to the table or graph and set the sorting by that column. The values will be sorted by column name. You can hide the Month Number column so its values are not visible in the report.


Create a dummy (blank) column in OBIEE

Sometimes we need to add a dummy column to OBIEE report. This is specially true for combine request reports (acting as unions) when we need only the values from one part of the union and nulls or zeroes for the other. To acheive that, we need to add a column with either null or zero value (depending on our requirement). The values to put inside the dummy column’s formula are different, depending on the column’s data format.

If the column is used as a dummy in combine request report it should have the same column type as its respective column in the other part of report – numeric, text or date. Otherwise you’ll get the ODBC error in results.


To create a dummy column with null or zero value, add a column to the report’s criteria and change its formula to one of the below:

Column with numeric values

CAST(null as DOUBLE)
Dummycolumn05 or

Text column

Dummycolumn04 or
(two single quotes)

Date column

CAST(null as DATE)