How to get previous 2 years data in OBIEE 11g analysis - obiee

When I click year prompt, It must display both current year along with previous 2 years data in OBI 11g (Analysis).
eg., when I click 2015 in prompt, It must display 2015,2016 and 2014's data.
Could anyone of you suggest me how to do it?

Many options. Fastest = presentation variable + analysis filter:
"Time"."Year" >= #{pv_Year}{2017} - 2 AND "Time"."Year" <= #{pv_Year}{2017}
This of course assumes that your "Year" is a numeric value and not a string.

Related

Microsoft Power BI, DAX - tricky ALLSELECTED with 2 values in slicer, but show only TOP 1 row in visual

This question is an extension of an already answered question, which I posted this week.
I have the below situation in Microsoft Power BI.
I have 2 simple tables:
1) CountryTable
2) YearTable
There is a 1-M relationship between YearTable and CountryTable.
The latter (YearTable) is used to feed values into a slicer.
(In my client database, Year has some alphabetical prefixes, such as Q1-2022, so I prefer to use YearOrder column to sort the Year column at the backend, while the slicer will display the Year column.)
The former (CountryTable) is the main table, with just a few sample rows.
These two tables are related via the Year column.
The Year slicer always has EXACTLY 2 values chosen in my Power BI report.
I need the Maximum of these two values of the year slicer as a measure, for each row of my visual.
At the same time, these two year values of the slicer must remove the unwanted rows in my report visual, based on the slicer selection of year values.
For example, when the slicer has 2019 and 2020 chosen, I need the value as in the DesiredOutput1 page.
Similarly, you can see DesiredOutput2 (Slicer values are 2020 and 2022); DesiredOutput3 (Slicer values are 2019 and 2022) pages.
I have indeed successfully obtained DesiredOutput1, DesiredOutput2, DesiredOutput3. Thanks to all the folks who helped me attain this.
Now, my main requirement in this posting, is this:
After obtaining the DesiredOutputs above, I need the following output:
Show only the TOP 1 row (ASC order of Year column, which is the minimum value of the slicer).
Essentially:
Year column of the visual: Minimum value of the slicer
MaxYear_Measure_SlicerSelection: Maximum value of the slicer (maximum of the two values chosen in the slicer)
You can see below:
Note: MaxYear_Measure_SlicerSelection measure can refer to any one of the two measures [MaxYear] or [MaxYearMeasure_Community] (see the .pbix file for the formulas of the measures).
Any idea ?
I prefer the Year column of the visual not to be converted to a new measure. Would RANKX help in this case ? Any thoughts?

SSRS Matrix Variance Column - Report Running Slowly

I am creating an SSRS Report based on a Stored Procedure; the procedure calls in the last six months of data based on the month the user enters into a parameter (ex. 201604). Currently I have this data going into a matrix, and along with those six months the report needs to have a variance column for the latest vs. directly prior month (ex. 201604 vs. 201603)
Right now I have a formula that works using a column that I created within the stored procedure to designate whether the month a row is in is CURRENT, PRIOR, or NONE if it is not being used in the calculation.
=SUM(IIF(Fields!VarHelper.Value = "CURRENT",1,0) * Fields!stock_value.Value
-
IIF(Fields!VarHelper.Value = "PRIOR",1,0) * Fields!stock_value.Value)
I am using this formula in three areas/cells on the report, and for some reason it is causing the report to run very slowly (around 45 seconds to run). Without these variance formulas in the report it runs almost instantaneously.
Would someone be able to either a).suggest a better method of calculating the variance between the latest two months in a matrix, or b).be able to at least shed some light on why this may be impacting report performance?
Thank you in advance!
Try to report the calculations on the query.
Two ways possible : if you made a sql query : make it in the select.
Or, add calculted field in the dataset.
And make sum on these fields.
May be you will win time : because the database server will make the job instead of the report server.

Pulling data from Crystal Reports

My data is stored in Oracle and the only way I can run a report with it is using Crystal Reports. I have a set of data that looks like this ,,,,,,,,,,1, or ,1,,,,,,, or ,1,,,,,1,,,,1,. There are more variations.
Each one means a value is true for a record. There are about 54 'ticks/commas' What I want is all records with the one at the X spot. So for one report I may want all records in the 10th spot that have a 1. There may be other times where I want the records where the 1 is after spot 36. I agree it will pull other records but the main once I want is the X spot.
How do I get this? I tried a Like command but that does not narrow the data down far enough. I am familiar with SQL but not Crystal.
Any help would be great. TIA
In Crystal, you might try setting up a Parameter Field to hold a numeric value (1 to 54) then use that in a formula as the Record Selection. You'll be prompted to enter the parameter when you run the report.
In record selection i was initially going suggest the following which would bring back all records with 1 in the 12 spot. But this makes it hard to bring back a range.
split({yourfield},",")[12] = 1
This will bring back the same
instr({#test},"1") = 12
Then for your suggestion above you could use the following to bring back any record if it has a one in any spot after 36
instr({#test},"1") >= 37
As long as there is only one 1 in the field you can use this for other ranges as well.
Actually I don't want to disturb both answerts by Clayton Morris and CoSpringsGuy hence posting my answer.
You need to combine both the solutions to get the desired result.
Create a number parameter and provide either 1 to 57 numbers or keep just a filed to enter desired number.
Now in record selection use the formula given by CoSpringsGuy
if instr({databasefield.column},"1") = {?Inputnumber} --parameter field
then {databasefield.column}

How to get Current and Previous Year details in report

Hi i am facing a problem where in report level i will give prompt for year
based on prompt result i should get previous year details also
Any suggestions would be helpful
first of all dublicate the query. For the second query, you must create two variables in the universe level. Both of these variables will capture the prompt values and do the year subtraction. Now back to second query , instead of prompts , you should use these previously created variables.
If you can create/modify the query yourself, you can play with date arithmetic, some examples in SQL Server can be found here: http://www.devx.com/dbzone/Article/34594, if you don't use SQL Server, you can look for the especific functions of your database by googling "date arithmetic [Your Database]".

How to load select lists based on a datepicker selection in Oracle Apex?

I have a date picker, but I also have three select lists for Day, Month, and Year. How can I load those as soon as the date picker is used to select a date?
I've made a small example: here
I have the standard datepicker set up, i did restrict the range of years on this one (2005-2015).
The three select lists i have filled up with static lovs: days -> 1 through 31, months -> 1 through 12 buth with their name as display value, years -> 2005 through 2015.
To set their values, i created a dynamic action on the datepicker:
3 actions are required, to set the selected value of each select list. Be aware though, this causes 3 ajax calls. But the implementation is basic and doesn't require you to write javascript and ajax callbacks.
Each action is similar to this one:
Days: TO_CHAR(TO_DATE(:P24_SOME_DATE), 'DD')
Months: LTRIM(TO_CHAR(TO_DATE(:P24_SOME_DATE), 'MM'), '0')
Years: TO_CHAR(TO_DATE(:P24_SOME_DATE), 'YYYY')
Mix 'n Match to suit what you need. Hope this helps!
In Year range, just put the previous year nothing to do with Manual.

Resources