Is it possible to create a hierarchy (drill-down structure) based on other flat hierarchies in icCube? - mdx

I would like to build hierarchies with as much as depth possible to offer users "navigation paths" to their data.
Often, I am blocked as the metadata can not be properly placed into multilevel hierarchies due to source data constraints. Or if I manage to solve it, I can only make one navigation path and not an alternative that mixes the levels.
Consider for example the following cost center structure:
Business Unit > Manager > Department > Cost Center
To enforce this structure I have to do a lot of preparation in the ETL to ensure these relations will exist all the time.
Would it be possible in icCube to define for this (and similar) examples 4 hierarchies:
- Business Unit -> flat Business Unit -- links to fact
- Manager -> flat hierarchy Manager -- links to fact
- Department -> flat hierarchy Department -- links to fact
- Cost Center -> flat hierarchy Cost Center -- links to fact
and as a next step define the following hierarchies based on these (a bit similar to the icCube's MDX+ Category function):
hierarchy/ navigation path:
Cost Center (BMDC)
level 1: [Business Unit]
level 2: drill down to [Manager]
level 3: drill down to [Department]
level 4: drill down to [Cost Center]
but also:
Cost Center (MBDC)
level 1: [Manager]
level 2: [Business Unit] (that belong to this manager)
level 3: [Department] (that belong to this Business Unit)
level 4: [Cost Center] (that belong to this Department)
or a slowly changing structure like this:
Cost Center (Year)
level 1: [Year]
level 2: [Business Unit]
level 3: [Cost Center]
or just a useful end-user navigation path like this:
Product - Customer
level 1: [Product]
level 2: [Customer]
Then, as a logical next step, I would like to use these navigation paths in the dashboard filters to display the hierarchy for the end-user to navigate through. Very powerful in my opinion.
Is something like this possible to do in icCube?

Creating a new 'physical' hierarchy is not the best idea if we want this feature for the reporting. Here I'm going to explain a solution that is based in icCube reporting.
The first point is defining our navigation strategy in the server. For this you can use a declared function that will be responsible for 'branching'. As parameter we will take the MDX member on which we want to drilldown (_member).
Something like :
CREATE FUNCTION ic3N_Simple(member_) as
CASE
WHEN member_.hierarchy is [Customers].[Geography] THEN [Time].[Calendar].[Year]
WHEN member_.hierarchy is [Time].[Calendar] THEN Tail([Product].[Category],4)
ELSE member_.children
END
Once we've this we can go to the reporting and in any widget use this strategy :
There you've defined a strategy in the reporting that is defined in the server and can be reused in any report

Related

Different value in PowerBi chart per drillthrough level

A productivity chart consists of a three level date hierarchy (1) year, (2) month, (3) week as Axes. Drilling down the chart over the date hierarchy, I would like to display a different measure per drillthrough level. Such that, drillthrough level (1) date[year] displays measure A, (2) date[month] displays measure B, (3) date[week] displays measure C.
Appreciate any help on this issue a lot.
Thanks in advance!
The following appeared working for me and provides a unique measure per drillthrough level:
Measure_PAR = IF(ISFILTERED(Query1[Date].[Year]) && ISFILTERED(Query1[Date].[Month])
&& ISFILTERED(Query1[Date].[Week]), Measure C
,IF(ISFILTERED(Query1[Date].[Year]) && ISFILTERED(Query1[Date].[Month]), Measure B
,IF(ISFILTERED(Query1[PRODUCTIONDATE].[Year]), Measure A)))
This is not possible in the traditional drill-down options using hierarchy. You will just be able to drill-down into the next level of hierarchy for the same measures. But, you can do a version of your desired output using Cross-report drill-through. You will have to create 3 report pages in this case, one for each level and then you can use the drill-through to report option to get the desired result:
https://learn.microsoft.com/en-us/power-bi/desktop-cross-report-drill-through
This may not be the exact solution you are looking for, but I believe this is the best possible solution for your request. Hope this helps.

MDX Dimension Navigation

I am on an MDX adventure and I'm at a point where I need to ask some questions.
I have a very basic dimension named Car. The attributes which comprise Car are as follows-
-Manufacturer
-Make
-Color
-Year
My fact table contains a sales measure ([Measures].[Sales]). I would like to know , without explicitly defining a user hierarchy, how to sum the sales from
a specific group in this hierarchy
For example, I want to sum the sales of all red Trucks made in 2002. My attempt errors out-
sum([Cars].[Make].[Make].&[Truck]&[Red]&[2002], [Measures].[Sales])
How can I navigate the attribute hierarchy in this way? I will be browsing the cube in excel
Thanks
If you open an mdx query in SSMS and drag a member from one of your attribute hierarchies into the query pain you will see the full name.
You definitely cannot chain hierarchies like this ...].&[Truck]&[Red]&[2002]
Each full name will likely be similar to what MrHappyHead has detailed but usually the attribute name is repeated e.g. for Make:
[Cars].[Make].[Make].&[Truck]
MrHappyHead have wrapped it all in the Sum function but this is not required - just wrap the coordinates in braces and a tuple is then formed which will point to the required area of the cube:
(
[Cars].[Make].[Make].&[Truck],
[Cars].[Color].[Color].&[Red],
[Cars].[Year].[Year].&[2002],
[Measures].[sales]
)
note: square brackets are pretty standard in mdx.
Is it something like:
Sum(
Cars.make.&[truck],
Cars.color.&[red],
Cars.year.[2002],
Measures.sales
)

Understanding the Cube display in SQL Studio Manager

I have built a small data warehouse using the Adventure works database. I have deployed it to SQL Studio Manager. I have written my first MDX query
select
customer.[full name].members on rows,
order (measures.[sales amount],asc) on columns
from [Adventure Works DW2012]
Please see the screenshot below:
I understand that the top level of the hierarchy are dimensions i.e. Customer, Date, Due Date, Interne Sales, Order Date, Product and Ship Date. I understand that dimensions have attributes. For example: Model Name, Product Line, Product Name are attributes of the Product dimension and Product Model Lines is a hierarchy of the Product dimension.
What is meant by: Financial; History and Stocking?
You've come up against something I think is a genuinely confusing and ill-designed aspect of SSAS.
You're correct that Model Name, Product Line and Product Name are attributes of the Product dimension. But what you're seeing here (in your screenshot) is hierarchies called Model Name, Product Line and Product Name.
These are not "hierarchies" in the sense that most people use the term (a structure with more than one level). They're the "attribute hierarchies" based on the attributes of the same name. They only have one level two levels. (EDIT: as whytheq pointed out, they have one leaf level, and almost always also have an "All" level).
(EDIT) Product Model Lines is a "real" (aka "user") hierarchy, with multiple levels apart from the All and leaf levels, based on multiple attributes.
Financial, History and Stocking are "folders". They get "created" by the setting of any AttributeHierarchyDisplayFolder property of any Attribute in the Dimension design (or the DisplayFolder property of any "real" hierarchy). They have nothing to do with any dimension structure - they're just for display convenience. Probably necessary because, as becomes clearer the more I try to explain it, the structure of Dimensions in SSAS is really unnecessarily complicated.
You can hide the "attribute hierarchies" from client applications (e.g. Excel) by setting the AttributeHierarchyVisible property of the attribute to False. But they'll still show up in the MDX "helper" screen you're looking at.

SSAS hide measure for certain dimension

How to hide measure or a scope if user choose certain dimension or go to certain dimension hierarchy level?
Thanks.
Try something like this in your MDX script:
FREEZE([Measures].[My Measure], [Product].[Subcategory].[All]);
([Measures].[My Measure], [Product].[Product].Members, [Product].[Subcategory].[Subcategory].Members) = null;
Freeze ensures the next statement won't null out the category level totals. The next statement bulls out that measure for the whole product dimension up to the subcategory totals but not above.
Note this is fine for nulling out meaningless numbers but isn't a security feature. A savvy user could do a drillthrough command to get the product level numbers. Or a savvy user could connect in a special way and clear the whole MDX script for his session so he sees the detailed product data.
For a more secure approach:
If you can null out product data for all measures then setup role based security. In dimension data security only grant access to member Subcategory.All only but uncheck visual totals on the advanced tab so that the subcategory grand total is the real total.
Or setup a second slimmed down Product dimension that only has the top levels not the detailed product levels. Then only tie that dimension to this measure group.
Or create a second measure group that does a group by in SQL and joins to the Product dimension only at the Category level. Thus there is no detailed data only rollups. Then with security control whether a used sees the detailed measures or the summary measures.
On measure properties you can set set visible property to false for the measure you want to hide. Another option is to use perspective and choose again what you want to hide or not.

How to transparently show non-additive measures in Analysis Services as if they were additive

In my cube there are certain measures which are non-additive, however I can compute a value for every drill down level. Unfortunately the computation is too complex for it to be done in in Analysis Services.
If I precompute the drill down levels I'm interested in, I have to put those values into a separate fact-table / measure group for each drill down level, or don't I? Is it possible to do this in a way that is transparent to the end user? So it should look like there is only one fact table and SSAS automatically selects the value from the correct fact table based on the drill-down level?
I found the answer in a Microsoft forum: http://social.msdn.microsoft.com/Forums/en-US/sqlanalysisservices/thread/d5998b23-936b-4e7b-b593-bd164b20c022
On the Calculate tab you can define a scope statement:
In this really trivial example, internet sales amount will be shown when reseller sales amount is chosen (at calendar quarters).
scope([Measures].[Reseller Sales Amount], [Date].[Calendar].[Calendar Quarter]);
this=[Measures].[Internet Sales Amount];
end scope;