Thursday, January 21, 2010

Oracle BI - Cross Column Conditional Formatting in Pivot Table (workaround)

Pivot table is a great way to analyze a cube of data. Oracle BI supports pivot table, but conditional formatting having condition on the same column works correctly. If  you configure condition which is based on the column other than the one you are formatting conditionally, the conditional formatting will appear in Table view but not in Pivot table view.

Fortunately, I found a workaround for it.
This is a sample report.
 

 I want to see region in a different color which has Billed Qty less than or equal to 50,000.
This would not display desired results in Pivot table.

Now the workaround is simple and  has html markup involved.

Go to criteria tab and modify the formula of Region attribute by clicking fx button.

The formula  of the attribute will be

"D2 Market".M04 Region" || ''

Here  '<!--' is an HTML tag, which can be used to comment / remark / hide some text in browser.

Note: If you copy and paste above formula, correct single quote ( ' ) and double quotes ( " ) if required. Because while copying from browser, it may be replaced with some special characters.

Now, time is to set format and conditional format.


Set column format to HTML by clicking format hand icon and go to data format tab of Region tab.


To set Conditional Format, go to Conditional Format tab and click on add condition. Select Region here.

You will have to enter values as:

East
West
South
North





When you use case statement, it doesn't appear in the list at the right side. If you have not used case statement then you would be able to see the values, but you will have to select all values which are <=50000.

Then select formatting you want to be displayed. That's it, we are done. Now run the report in pivot table.



9 comments:

John Minkjan said...

Nice!

Regards

John
http://www.obiee101.blogspot.com/

Ravi said...

Hi Diptesh,

Is there a way we can do a cross column formatting on a measure field in the pivot view. For example we have a requirement where the sales values should be shown in red if the method used (which is another column's value) is 1 otherwise show it as it is.
Also the approach that you have mentioned is restricted because we have to hard code the values while applying the conditional format thing.

Thanks,
Ravi

Diptesh said...

Hi Ravi,

thanks for posting your question.
That helped me find better solution for this. I might write a separate blog post for that. But here is the information for your quick reference.

1. Add original measure twice (for validation purpose)
2. Modify formula of one to:

CASE WHEN METHOD=1 THEN '<font color=green>' ELSE '<font color=red>' END || CAST (ORIGINAL_MEASURE AS CHARACTER ( 30 )) || '</font>'

3. Change column format to HTML

atade said...

Good one,but the only disadvantage of using HTML datatype is that when we download the report in PDF (from Dashboard page)the HTML code appears instead of values.

Ask and Ye Shall Receive said...

Hey Thanks.. I was able to format the metrics in the pivot view

SN said...

Hi Diptesh
Even I am trying to do a cross column formatting on a measure field in the pivot view.I want to use indicators like bulb, arrows (which are provided by oracle in condition formatting option "images") how can I achive this
Thanks
Sameer

irepetproduct said...
This comment has been removed by a blog administrator.
eajaz said...
This comment has been removed by a blog administrator.
carpetcleaning said...
This comment has been removed by a blog administrator.