Ordering Dimension Hierarchy SSAS - ssas

I'm quite new to SSAS so bear with me!
I have created a snowflake schema with Members in the Fact table and I have create a distance from club table with DistanceID,Distance,DistanceRange (this is denormalised in SQL Server with distance range appearing multiple times per distance. e.g Distance 1 has a range of 1 - 10 and Distance 2 also has a range of 1 - 10
I have then created a hierarchy with Distance Range at the top and Distance beneath it. This works OK in terms of providing drill down functionality but the ordering is wrong for distance range. It is ordering them by Distance Range as a string so I get 1-10 followed by 100-10 and then 20-30.
How do I tell the Distance Range to order by Distance ID
Not sure if I'm doing it right.

When you are editing your Dimension, click on the attribute DistanceRange and in the properties, there should be an option to 'OrderBy' and 'OrderByAttribute'. Try and use those the get the result you need. Otherwise, you might want to try change the 'Type' in the properties menu and see if that works.

Related

Can someone explain the following Essbase code: FIX, #relative

Can someone please explain the below Essbase code to me please? This is my first time looking at any Essbase code and I'm getting a bit confused as to what it is actually doing.
FIX(&Mth, &Yr, &Version,
"Sector1","Sector2", #relative("Source Code",0), #relative("Channel", 0) )
FIX("AccountNo","DepNo")
DATACOPY "1A11"->"A-500" TO "1BCD"->"C-800";
ENDFIX
ENDFIX
From what I have googled the following is my understanding:
Creates a new command block which restricts database calculations to this subset.
Passes the following members into the command to be used:
Mth
Yr
Version
Returns the following fields:
Sector1
Sector2
returns the 0-level members of the Source Code member - meaning it returns the members of the Total Source Code without children (no other dimensions)
returns the 0-level members of the Channel member - meaning it returns the members of the Channel without children (no other dimensions)
Begins a new command block and passes the following members into the command to be used:
AccountNo
DepNo
Copies the range of cells 1A11, A-500 over to the range 1BCD, C-800
The above is what I understand from the oracle documents on each of the functions, but I can't actually figure out what is happening.
Welcome to the world of Essbase; it can be a little daunting at first especially if you're new to the concept of multidimensionality. You are on the right track regarding analyzing your calc script.
Try not to think of the FIX statement as a command block, per se. A FIX is used to select a portion of cells in the cube. Every single piece of data in your cube has a particular address that consists of one member from every dimension, plus the actual data value itself. For instance, a cube with the dimensions Time, Year, Scenario, and Location might have a particular piece of data at Jan->2018->Actual->Washington. The number of possible permutations of data in a cube can quickly get very large. For instance, if you're organization has 4 years of data, 12 months in a year, 100 locations, 10000 accounts, 3 versions, and 10 departments, you are talking about 4 * 12 * 100 * 10000 * 3 * 10 = 1.4 billion different potential addresses (cells) of data – and that's actually fairly small for a cube, as they tend to grow much larger.
That said, FIX statements are used to narrow down the scope of your calculation operation, rather than operating on the ENTIRE cube (all 1.4 billion cells in my hypothetical example), the FIX essentially restricts the calculation to cells that match certain criteria you specify. In this case, the first FIX statement restricts the calculation to a particular month, yr, version, sectors, sources, and channels. Note that the ampersand on Mth, Yr, and Version means that a substitution variable is to be used. This means your server or cube has a substitution variable value set, such as the variable Mth = "Jan" and Yr = "FY2018" and Version might be "Working" or "Final" or something similar. I would guess that Sector1 and Sector2 are possibly two different members from the same dimension. #RELATIVE("Source Code", 0) is a function that finds the level-0 members (leaf/bottom-level members in a dimension, that is, members that do not have children below them) of the specified member.
In other words, the first FIX statement is narrowing the scope of the calculation to a particular month in a particular year in a particular version (as opposed to all months, all years, all versions), and for that particular month/year/version (for either Sector1 or Sector2) it is fixing on all of the level-0/bottom/leaf members in Source Code and Channel dimensions.
The next FIX statement just further narrows the current scope of cells to calculate on in addition to the outer FIX. It's not uncommon to see FIX statements nested like this.
Lastly we get to the part where something actually happens: the DATACOPY. In the given FIX context, this DATACOPY command is saying that for EACH cell in the current FIX, copy values from the source to the destination. DATACOPY is a little more straightforward when it's just DATACOPY "Source" TO "Target" as opposed to using the inter dimensional operator (->)... but this is perhaps more easily understood in terms of the time/year dimensions. For example, imagine the data copy was written like this:
DATACOPY "FY2018"->"Dec" TO "FY2019"->"Jan";
In this DATACOPY I'd be telling Essbase that for the given FIX context I would like to copy values from the end of the year (data values where the year is FY2018 AND the month is Dec) to the beginning of the next year (data values where the year is FY2019 AND the month is Jan). Your DATACOPY is working in a similar fashion, but using cost centers or something else. It all just depends on how the cube is setup.

Filter SET by currentMember.MemberCaption

I have a SET of members of some dimension, let's say [Dim].[Dim].[Dim]. Then I wrote a query that returns all the elements from this dimension for 2016 year of some measure, let's say there are 5 of such.
The next step that I want to make is to find first one member in this dimension with the same name (as CurrentMember in row) but for 2015 year. As result, I want to calculate some measure with regards to 2015-member, not 2016's.
So the problem is in scope - I can't GENERATE such set because CurrentMember's function scope will be equal to GENERATE's scope so I am unable to extract actual current member that is on row now and for which I want to find "same previous by name" members.
Am I able to do this with plain MDX or should I go with some workaround like finding such "same" elements in t-sql view and making child-parent relations in cube by hand? The second approach I think is very undesirable and ugly.
Thanks.
Is there a reason you can't just use .PrevMember on the Time (Year, I guess) dimension?
WITH MEMBER [Measures].[SomePrevYearCalculation]
AS ([Time].[Year].CurrentMember.PrevMember,[Measures].[AMeasure])
SELECT
{[Measures].[AMeasure],[Measures].[Some2015Calculation]} ON 0,
[[Some complicated dimension stuff]] ON 1
FROM Cube
WHERE [Time].[Year].[2016]
Or are you dealing with a dimension that has multiple duplicate Names at leaf-level, so that you can't match the 2015 to 2016 figures by the actual dimension member?

Tableau - Adding dimensions together to show overall revenue

I am very new to Tableau (first day user) and have been a long time Excel user. I am trying to fully understand the power of Tableau to eventually move away from Excel.
I have a question concerning dimensions and creating a calculated field.
My table has multiple categories and sub-categories. My goal is to display the total revenue and average order value per chosen sub-category (this seems easy enough).
I want to then take those sub-categories and show a combined sum of revenue and average of the average order value. I am stuck on trying to also combine these sub-categories to show a blended view.
Furthermore, the 2 sub-categories are weighted very differently. The average order value of 1 has a much heavier weight than the other and will definitely affect the AOV when combined. How do you also assign a weight to this combined total?
Any help will be much appreciated. I know this may be a rather simple solution but I am new to the program and am having difficulty finding this answer.
Tableau screen:
or
img1 http://postimg.org/image/dq5wqgnyl/
Best,
CR
Put sub categories in the rows column.
Put sum revenue in the text pill in the marks section
In the analysis tab on the top select column grand totals.
I'm unable to see your images,i hope this answers a apart of your question.

Two Dimensional Diagram with aggr function

I'm having a very curious Problem in QlikView.
I have a number of readouts from a Database which show certain amounts of time in a different state.
In that table there are 49 variables that describe the state, there are 7 levels of i.e the SOC and seven states of the Temperature.
i.e the one of the fields could be named: SOC1_T1 or SOC2_T1 and so on...
So what i get is a table full of readouts in which every i have an specific id for the object, the state of the variables and an age. There are multiple entries per Object.
What i want to do is to plot a two dimensional diagram over all the states so i get SOC over Temperatur Histogram(Average of the maximum (or newest) value of every object).
I tried creating to Dynamic (or syntethic) Dimensions (ValueLoop(1,7) and ValueLoop(1,8).
In the formulas i reffered to them with
=If(ValueLoop(1,7) = 1 and ValueLoop(1,8) = 1,
(avg(aggr(FirstSortedValue (SOC1_T1
, -age), id)) * 100))
and created 49 Formulas with each state variable output.
Problem now is:
It only shows the first entry. I can replace the whole expression in the if condition with a specific number (100) and get a result. I also plotted the inner expression into a Listbox and checked wheter the result is not null.
As soon as I delete the aggr function and just take the AVG over everything (which is not what i want). Everything works fine. When i turn back to aggr, only the first one is shown.
Doesnt help by the way when i delete one of the dimensions, this doesnt work one dimensional either.
Any ideas or workarounds?
Greetings
Julian

SSAS how to build up dynamic range dimension

In current cube, I have a calculated measure of average investment dollars. Now I want to create a range dimension table dynamically based on different amount for every department. The table would be something looks like this:
Dim_DollarRange
ID MinRange MaxRange Description
1 1 2 1-2
2 3 5 3-5
3 6 9 6-9
4 10 14 10-14
So basically there are two questions:
1) How to set up dimension table based on measures in cube dynamically?
2) How to look up in range dimension in SSAS?
I'm new to SSAS, thx for any answers or tutorials!
Use the views that feed the Data Source Views to check the related fact data in your source system and filter the resulting dimesion list accordingly. If you do not have a set of views interfacing between your source and cube, you can perform the same within your queries directly, it is just not as clean.
I use this technique to limit long dimension lists to only used values, providing users that directly access the cube (with Excel etc) a precise list of used options within their filters / slicers. It does have the downside of masking possible options from users reports until they are consumed i.e. you will not see Cancelled Orders = 0 until the first cancelled order triggers of its creation.
I am assuming that you want the data to be dynamic, not the creation of Dimenions i.e. you know you require Dimension A, B, C and they relate to Fact Y and Z. If you truely want to dynamically create whole dimensions (dimension name, measure group relationships etc), I do not think this is possible.