Showing posts with label Prompt. Show all posts
Showing posts with label Prompt. Show all posts

Getting 30days back data from the selected date in dashboard prompt

1) Create a prompt day week and declare presentation variable


2) Here is the report ,i pulled product and booked qty

To show 30days back booked quantity the date selected in prompts

In fx use

FILTER("Facts Other"."Booked Qty" USING (Time."Day Date"=TIMESTAMPADD(SQL_TSI_DAY, -30, DATE '@{day}')))




You can apply the same formula for 1....n days

For month level use
FILTER("Facts Other"."Booked Qty" USING (Time."Day Date"=TIMESTAMPADD(SQL_TSI_MONTH, -3, DATE '@{month}')))

where -3= three months back

Eliminating Too many values in dashboard prompts(Drop down)

f we create any dashboard prompts (drop-down) we may get Too many Values because by default obiee will support 256 values.

In order to over come that we have to add the following entry in instanceconfig.xml(OracleBIData\web\config\instanceconfig.xml)

http://docs.google.com/View?id=dgh6q53h_1247t9fpgjx
After adding this restart the presentation service

Dashboards as Prompts in obiee

In this post i will show how to make dashboard names as prompts with a list of names(drop-down) using guided navigation concept .I am doing with Sampelsales catalog.





I will show you the 02 History & Benching and 03 Tering & Distribution dashboard as drop down in prompts.

Step1: Creation of a prompt any dummy column in Fx give this formula

CASE WHEN 1=0 THEN "Column_Name" END

Step2: In "Show" section use SQL Results instead of All Values,sql to be like this

SELECT CASE WHEN 1=0 THEN "D2 Market"."M01 Market" ELSE '02 History & Benching' END FROM "Sample Sales"
union all
SELECT CASE WHEN 1=0 THEN "D2 Market"."M01 Market" ELSE
 '03 Tiering & Distribution' END FROM "Sample Sales"

Step3 
:Assign a presentation Variable to that prompt in the below picture you can see thatone



Step4: The prompts to be like this

Now we have Dashboard names as drop down in a prompt.But,we have to show related reports for a dashboard.This can be achieved by using Guided Navigation feature available in obiee.
















Guided Navigation is used for Report placeholders(Sections) .The section will show based on the intermediate report condition.
Create intermediate report and pull dummy column










Later use the same report in guided navigation section .So,if any user select 02 History & Benching itshould the respective report which should satisfy above condition




Step5:

Section 2-->Properties-->Guided Navigation-->If this section condition satisfies it will show Bench To Individual Trended report
 Like this for all the 03 Tiering & Distribution related reports use the same condition For the 03 Trending & Distribution do the same but we have to use different guided report by changing the filter condition to 03 Trending & Distribution

'03 Trending & Distribution is equal to /is in @{DashobardName}

Step6:
Finally,place all the reports related to both dashboards in a single page and give appropriate guided navigated report based on filter condition(DashboardName).So that when ever a user selects a Dashboard Name(in prompts) .It will pick up those sections using guided navigation condition report.The following two figures shows you








Editing All choices in Dashboard prompts of OBIEE

Step1: Create a prompt under the Sql results use the following SQL

SELECT CASE WHEN 1=0 THEN Products.UPC ELSE 'All Items' END FROM Paint
UNION ALL
SELECT Products.UPC FROM Paint

a) Why 
we are using CASE WHEN 1=0 whether that condition is always false.Because the BI Server will refer to a table to fire query.If you doesn't give th
en it will give an error like

State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 42021] The query does not reference any tables. (HY000)
SQL Issued: SELECT 'All Items' FROM Paint UNION ALL SELECT Products.UPC FROM Paint






Step2:In the report you will get No results where UPC is equal to All Items













Step3: 
We are getting this because obiee (All choices) will pass null values.So NULL values in the obiee generated query we will not have any Where condition.

Step4:First Declare a Presentation Variable in Prompts after that in formula section (Fx) give this formula

CASE WHEN '@{UPC}'='All Items' THEN Products.UPC ELSE '@{UPC}' END
and make this column as IS Prompted


Step5:Now you are able to see the Results when it was "All Items"


























Oracle BI EE 10.1.3.4.1 – Multi-Select Prompts, String Aggregation

One of the issues that people often face while using BI EE is the lack of control on Multi-Select prompts. One cannot set Multi-Select prompts to a presentation variable & similarly one cannot display the multi-selected values in a report (only filter view supports the display of all the selected values). The most common requirement is to do string operations on the multi-selected values by treating them all as a single string.
The other requirement that i have seen in the past is to do String Aggregation on certain dimensional attributes. Currently BI EE does not have any specific aggregations for strings. One can theoretically use FIRST, LAST etc kind of aggregation on string columns but those are not aggregations per se. A typical string aggregation would involve concatenation of all the strings in a specific format.
Both the above requirements can be solved by a simple technique. From a requirements perspective, they are different. But from an implementation standpoint both are similar as both the requirements require BI EE to do a string concatenation. To accomplish this we shall be using the COLLECT database function that was introduced in 10g. If you are in pre-10g release, you can use the STRAGG function created by Tom Kyte. And if you somehow have upgraded to 11gR2, then you can useLISTAGG. The idea is, we push down the aggregation part of the strings to the database and then use them directly in BI EE. The example that i shall be going through today will involve a simple Mult-Select Prompt on the CHANNELS_DESC column of the CHANNELS table in the commonly used SH schema. The requirement is to display the chosen multi-select values as a column in the report as shown below
image
There are basically 2 ways of achieving this. I will demonstrate both of them here. Both the approaches require the aggregation to be pushed into the database. So, we start with creating a Type and a database function to convert the output of the COLLECT function to a set of strings.
create or replace type MultiSelect as table of varchar2(1000);
CREATE OR REPLACE FUNCTION MultiSelect_Pipe (p_MSP IN MultiSelect)
RETURN VARCHAR2 IS
     var_msp VARCHAR2(4000);
     var_index NUMBER;
BEGIN
var_index := p_msp.FIRST;
IF var_index IS NOT NULL THEN
 var_msp := '(''';
 WHILE var_index IS NOT NULL LOOP
  IF var_index <> 0 THEN
   var_msp := var_msp || p_msp(var_index) || ''',''';
  END IF;
  var_index := p_msp.NEXT(var_index);
 END LOOP;
 var_msp := substr(var_msp,1,length(var_msp) - 2) || ')';
END IF;
RETURN var_msp;
END MultiSelect_Pipe;
If we test the above function in SQL, we should get the output in a string concatenated form.
select distinct
multiselect_pipe(cast((collect(channel_desc) Over ()) as Multiselect))
AS Channel_desc_agg from channels
image
Approach 1:
This approach will directly use the above function that we created above using EVALUATE from the repository. There are some drawbacks with this approach which shall be covering later. To implement this, we need to create a new column and basically use the same function within Evaluate function in the repository as shown below
EVALUATE('MULTISELECT_PIPE(CAST((COLLECT(%1) OVER ()) AS MULTISELECT))' AS  CHARACTER ( 1000 ),
"ORCL".""."SH"."CHANNELS"."CHANNEL_DESC")
image
If this column is exposed in the presentation layer, one can now use this column in the report directly. It will capture the multi-select values from the prompt as well.
image
And if you look at the query, you will notice that the database function gets pushed in to the sql. The filter values applied on the multi-select prompt will be honored by the database function as well.
Select
     MULTISELECT_PIPE(CAST((COLLECT(T26412.CHANNEL_DESC) OVER ()) AS MULTISELECT)) as c1,
     T26412.CHANNEL_DESC as c2,
     T24112.PROD_CATEGORY as c3,
     sum(T24170.AMOUNT_SOLD) as c4
from
     PRODUCTS T24112,
     CHANNELS T26412,
     SALES T24170
where  ( T24112.PROD_ID = T24170.PROD_ID
and T24170.CHANNEL_ID = T26412.CHANNEL_ID
and (T26412.CHANNEL_DESC in ('Direct Sales', 'Tele Sales')) )
group by T24112.PROD_CATEGORY, T26412.CHANNEL_DESC
order by c1, c2, c3
There are a couple of drawbacks with this approach. Since we are not isolating the filter on the String aggregated column, if your fact table does not have a value for a chosen prompt value, that will not be included in the output. For example, lets assume that in the multi-select prompt we are choosing 3 channel values i.e Catalog, Direct Sales and Tele Sales. There is no transaction for Catalog in the Fact table. So, the string aggregated column will show only Direct Sales and Tele Sales. This is not a true reflection of the Multi-Select prompt values.
image
Also, the CHANNEL_DESC_AGG column requires CHANNEL_DESC column to be part of the query as well. If not, BI EE will try to push the analytic function into the group by clause there by resulting in an error.
image
image
Approach 2:
Both the issues above can be negated by using another approach. This approach will use the same database function. But what we will be doing here is, we will be modeling our repository in such a way that BI EE will split the above the report’s single query into 2 separate queries. So we start with creating a new database connection (this is needed) and copying the CHANNELS table over to the new connection.
image
Then we create a physical layer join between the CHANNELS table in the original SH schema database and the CHANNELS table in the new database
image
In the BMM layer, we need to snowflake the Channels dimension by adding a new logical table called Channels_Agg. This new logical table will contain the EVALUATE column(same as in Approach 1) and the CHANNEL_DESC column.
image
Create a logical snowflaked join between Channels and Channels Agg logical tables. In the presentation layer, expose CHANNEL_DESC and CHANNEL_DESC_AGG columns from the Channel Agg logical table. Lets now test the above Multi-Select report again with the same 3 values (one missing in fact table)
image
As you see, the above is a true reflection of the Multi-Select prompt. It always shows the values chosen in the prompt no matter what values are present in the fact table. If you look at the SQL, you would notice 2 separate queries being fired by BI EE.
image
Also, this does not depend on the selection of CHANNEL_DESC column in the report.
image
Currently we had to use the analytic function since BI EE cannot do analytic equivalent functions directly from the repository (though one can mimic them using level based measures but we do not have complete control on the queries). Hopefully as new releases come out, we should see such capabilities in the repository itself.

Sharing Prompts Between OBIEE Dashboards

Occasionally I lurk over at the OTN Discussion Forums, and the Business Intelligence Suite Enterprise Edition one in particular.
Today I saw a question on passing a dashboard prompt value between dashboards and not knowing the answer I decided to spend an while (I have a day off to day) on coming up with a solution (or two) and at the same time improve my OBIEE skills.
When you create a dashboard prompt you are given the option to specify the scope of the prompt as “page” or “dashboard” , but nowhere can you define a larger scope, even setting the prompt to populate a presentation variable is not much help as they too share the same scope.
In the end I came up with two ideas. The first is not very elegant, but does work, the second much more elegant, needs some work in the RPD, but getting to do what exactly I want has eluded me for now – so if I have missed a trick on this just post a response
Idea 1. Create a navigation link to the target dashboard and use the link to pass the parameter.
One of the common tasks in OBI reporting is to create navigation links from request to another, or from a request to a dashboard. We can define links to OBI objects by browsing them from the GUI or by typing in the URL directly. As well as accessing external websites (like linking to Google.com from a navigation link) we can also enter the URL of a OBI request or a dashboard, but here the excellent news is that we can also pass parameters to the object – and in the case of a dashboard we can supply the default value for a dashboard prompt. So on our second dashboard we need a dashboard prompt to accept the value and the reports to act on it. The first dashboard needs the prompt to populate a presentation variable and anarrative request to generate the link URL. This need only be a simple request that ideally returns very quickly, the key thing is to have dummy columns to report the value of each of the presentation variables to be passed. In the narrative editor we check the HTML Mark-Up check box and it the text edit window the URL of the dashboard and the parameters to pass – we need to specify both the target column and the value to pass; something like this:
href="saw.dll?Dashboard&PortalPath=/shared/Paint Demo/_portal/D2&Action=Navigate&col1=Customers.%22Customer%20Name%22&val1=%22@2%22">Link to Dashboard 2
Where @2 refers to be result of the second column of my request, in this case the presentation variable as displayed in the report.  Of course you will need to wrap the code with correct tags <a tags and watch out to escape the double quotes and spaces in the url.
Idea 2 I could not get to work; the idea here is to use a session variable to pass the parameter. I created an updateable session variable in the repository and created a simple report to display the presentation variable from the prompt, but in this case I went to the advanced tab of Answers report and added some pre-query code to update the session variable with the contents of the presentation variable – this seemed to work – but the second dash board did not see the the change in variable even though it was in the same session… oh well it almost worked.

How to build Dynamic Column Headings using Dashboard Prompts and Presentation Variables

Dynamic table headings are not straight forward in Oracle BI EE. However, we can simulate it’s behavior. In this article we have presented a trick to do it. With this you will be able to increase the user satisfaction and thus the BI solution acceptance.
The challenge
It’s usual to get a requirement like this one from business users:
I want to see the currency displayed in the column heading while removing it from the rows
In other words, make the table heading dynamic. Unfortunately, Oracle BI EE does not come with such a feature: Column headings are static.
The solution
In this article we are proposing a trick to simulate dynamic column headings. It consists of:
  1. Modifying the original request criteria.
  2. Combine the first query with a second query containing the column headings.
  3. Edit the table view to adjust layout
  4. Create a Dashboard Prompt to select the currency

1. Modify the original request criteria

Let’s take the scenario of a report showing the Sales Revenue Amount in Dollars by District. The original query looks like this:
jordi 1
In order to modify the measure so that it retrieves the Sales Revenue Amount in other currencies we are going to modify the formula as follows:
jordi 2
The measure column is going to retrieve the value in the currency in the Presentation Variable “currency”.
Select any other column (we need a new column placeholder in criteria). Edit Column Formula and modify the headings as shown in the figure below. Type number 2 at the Field Formula and click on the Ok button. That’s going assign value 2 for the results query.
jordi 3
Move the new column to the first position so that sort is by default on the new column. After this, the criteria tab should look like this:
jordi 5

2. Combine the first query with a second query containing the column headings

Click on the button "Combine with similar Request" and select the same subject area you are using. Make sure the result Column is a combination of a Union of both criteria.
Select any column (we need a new column placeholder in criteria). Edit Column Formula and modify the headings as shown in the figure below. Type number 1 at the Field Formula and click on the Ok button. That’s going assign value 1 for the headings query.
jordi 6
Select the “Market”.”District” column (same as in the original request) and change the column formula as follows:
jordi 7
This needs to be done to ensure the second query uses at least one presentation column.
Select “Sales Measures”.”Dollars” column. Edit Column Formula and change the column formula as follows:
jordi 8
This is going to retrieve the value in the Presentation Variable “currency”. Its default value is set to 'EUR'.
3. Edit the table view to adjust layout
Display the results in a table view. The results should look like this:
jordi 9
Use conditional format in order to simulate the visuals of the heading. After that, the table should look like this:
jordi 10
Hide the Sort column:
jordi 11
Finally, modify the display to show results only.
jordi 12
Preview the results to discover that the new table looks like a normal table:
jordi 13
Save the request.
4. Create a Dashboard Prompt to select the currency
Create a new Dashboard Prompt including the currency code. Make sure that “Set Variable” is set to “Presentation Variable” and that you use the same name used in the request:
jordi 14
Save the dashboard prompt.
Create a new Dashboard Page including the new prompt and the request we just saved.
Click on “Save” and check the final result:
jordi 15
jordi 16
By changing the value in the Dashboard Prompt, the value in the column heading will change as well as the results shown as table rows.