Analysis Service Hierarchy Aggregation - ssas

I've read through some documents on how to produce a hierarchy and use it for aggregration.
I have a dimension which I created to produce a hiearchy. Simple one. Two columns. And the drill down works. I did it in Visual Studio.
STAT | Management
STAT | Stat Adjustment
So that's all good, except Management and Stat Adjustment doesn't add up to a total "STAT".
How do I add the rules so that Management and Stat Adjustment adds to STAT?
I can't find the settings in Visual Studio. And no amount of reading told me how to do it either, just explained natural and unnatural hierarchy.

Measures define how your data will "add up", not Hierarchies. I would set the Measure property for AggregateFunction to Sum.
Note this can be overriden by the MDX calculation script.
Also I would not use the Visual Studio cube browser for testing - this is based on the OWC control that came out in 2003 and has numerous issues and bugs. The functionality is also extremely weak e.g. cant save a query or export the results. I would run all tests using the end-user query tool e.g. Excel.

Related

SSAS Tabular - the more measure i created, the more time it need to Visual Studio to created a new measure

Actually my issue is : the more measure i created, the more time it need to Visual Studio to created a new measure. (Visual Studio stay in not reponding)
The measures are not really complexe but actually it take thirty seconds~one minute to create a new measure (and i have around 50-100 measures actually).
The temporary solution i have actually is to create the measures in the code page but i was wondering about the scalabilty of ssas tabular if i have to create 100 measures again.
-My memory : 16 Go, 2,60GhZ i7.
-The data in the fact table is about ~50 thousand lines.
-I don't have other project open.
-SQL server 2016, the SQL Server has the latest build 2020-09-28 (build : 13.0.5850.14).
-i don't have build action and i don't backup the data to disk.
I was wondering if it's normal that visual studio take some times between the creation of each measure.
If you have some tips or advice don't hesitate to share :)
Maybe i should try to split my measure per Fact Tables instead of created in one measure table?
Maybe there are some parameters i can try to change?
Depending on a lot of things, like how the data looks (not only the number of rows in the fact table, but size etc), the hardware, network etc, I would say it's not very rare to experience some delays and slowness working with SSAS in visual studio when it starts loading data into the grids in the designer. As someone mentioned in the comments, there are third party alternatives for editing tabular models that doesn't have this behavior/functionality.
However, if you still want to use visual studio there are ways to possibly get around this. For example if you have a dedicated server/database for development purposes, where you have views as sources for the tables in the tabular model, you can add a TOP condition to the SELECT statement in the views to eliminate/limit the data loaded into visual studio during development.

How to segregate SSAS Cube data for well established cube and reporting suite?

We have a well established SSAS cube design in production, with a large selection of SSRS reports and ad hoc user reports available. The cube design is somewhat complex, with a large number of business rules written into the calculations.
There is a new business requirements to add what is essentially a new entity to the data. Normally this would be allowed for in the design of the cube and would fit well within the existing dimensions, specifically this a new office location within a firm hierarchy linked to all the new fact data. However, the requirement this time is that is does not roll up within the main firm hierarchies, but should be reportable in the exact same way.
My thoughts on possible solutions for this:
Add the new entity as normal like in the example, a new office. Then change all the existing MDX SSRS reports to Except() this office.
Write more cube calculations that scope the firm level of all hierarchies and exclude the new office.
Create a new cube, which is an exact duplicate of the existing cube but uses a set of views which excludes the data via SQL. Copies of required reports could be pointed at this new cube.
I'm looking for options I have possibly not thought about and guidance on the best practice approach for this further development.
Please let me know if I need to add more information.
All your listed options seem like a lot of work.
I think this change could be more easily done within the existing dimension structure itself - rather than recoding every single thing in the entire cube to cope with this one exceptional case.
If, for example, your existing hierarchy looks like this:
ALL
Region
Country
Office Location
you could assign your "special" office to a new, irreal region and country, so that your regions list might look like this:
Europe
Asia
USA
South America
Special Office
The "special" office would then only roll up into the absolute highest level of the hierarchy. If required, you could mitigate this by adding a new level to the hierarchy, between "All" and "Region" - let's call it "Company" for convenience's sake - which would look like this:
TheNormalCompany
SpecialOfficeOnly
You could then use dimension security to restrict most users to member TheNormalCompany at this level in the hierarchy (but watch out for the Visual Totals gotcha). Those who do want to see the "special office" data can be restricted to the SpecialOfficeOnly member, or granted access to both.

SSAS tabular model slow

Hi i'm working on a large SSAS tabular model and it's so slow every time i change even the smallest thing it goes away and thinks about it for ages.
The model is massive and pretty sure that's the problem but I've inherited it like that so at the moment cant do anything about that.
Is there a way to stop SSAS loading all the data (or less data) while i'm developing the model in visual studio?
I encountered the same problem in my cube; apparently due to the hundreds of measures my model has. I tried the process clear method described by Vercelli but it did not help in my situation. To resolve this issue I did the following:
Open the project in VS
Go to Model in the Menu
Go to Calculation Options
Select Manual Calculation
This brought my time down from 7 - 10 minutes doing something as simple as hiding a measure to 3 to 5 seconds.
If you process-clear your workspace DB no data will appear on Visual Studio.
Navigate with SSMS to your workspace instance. The Database will appear as your tabular model followed by your userName and a GUID. Right-Click -> Process Database-> Process Clear.
Please try this with caution if your are not sure which DB you are processing.
PS: If your fact tables are partitioned, you can process-clear those and then process only some of the partitions in order to have some data to test.
There's nothing you can do about it for the time being - I'm in a similar situation and have searched far and wide for a solution!
What sometimes helps is if you delete the workspace files (the ones with the guid at the end) from the SSAS\data directory. Doing this deletes all the data in the local version of the model which will bring the file size a fair bit. I do it every now and then and find it does usually help - it still keeps the table structures and relationships etc
For big, mature models Visual Studio is not the best dev environment. Try to use Tabular Editor from GitHub created by Daniel Otyker. It's an editor that works in both on-line and off-line modes and is super fast. What's more, it lets you change things in bulk using either GUI or scripting via a bit of C# (nothing to be afraid of, though). There's a lot of documentation on GitHub and good examples that can very easily be customized. Also, Daniel has a video on YT that teaches how to use the editor to the best advantage. Hope this helps.
When building SSAS cubes with Visual Studio 2019 and you are having performance issues while maintaining the cube, for example, 3-8 minute long delays between modifications to the cube. The way to fix this issue is to Turn Off Automatic Calculation for the model and set the model calculation to Manual Calculation.
To change the calculation method, from the Visual Studio 2019 Enterprise SSDT main menu bar "Model", select "Calculation Options" and select "Manual".
As you can see, it allows toggling between "Automatic Calculation" and "Manual Calculation". If you select "Manual Calculation", then you have a menupad offering the option to "Calculate Now".

What transformations can be performed in MDX?

I'm new to MDX. I understand that MDX is a query language, not a data transformation language. However, I'm also aware that this distinction is partially meaningless; there is no clear line between transformation and reporting, and every query language is capable of some transformation. Proficiency in a query language requires knowing what transformations are reasonable, and which require a redesign of the underlying schema.
From what I've seen of MDX, it clearly has features designed for creating calculated members within a dimension. Beyond that, however, I'm not clear on its transformation capabilities. Can anyone provide a concise summary of which types of transformations MDX can reasonably be expected to do?
I don't intend for this question to be limited to my particular reporting challenge. However, by describing my project, I can illustrate a few of the transformation types I'm interested in. So, here's a description of what I'm working on:
I need to use MDX to create some inventory and sales reports. I'm working with Microsoft SQL Server 2008 Analysis Services. The data is organized into three different cubes: On-Hand Inventory, In-Transit Inventory, and Sales. My reports require that the data be transformed in several ways. For instance:
1) I need to infer a "Months" attribute from the "Weeks" attribute, using the rules of a 4-4-5 calendar. I'm fairly certain this can be done elegantly with MDX.
2) I need to infer a "Calendar Month" dimension from the "Months" attribute. I believe this can be done with MDX, but I'm not sure whether there is an elegant solution or a kludge which should be avoided in favor of a schema redesign.
3) I need to infer a "Region" dimension from the "Warehouse" dimension. I've seen no evidence that this can be done in an elegant way by MDX.
4) I need to calculate total inventory as On-Hand Inventory plus In-Transit Inventory. From searching the web, it seems that querying two different cubes is possible, but is discouraged in favor of schema redesign, but the water is still very muddy.
I would say most of your requirements can be done with Analysis Services, but not necessarily with MDX. Rather, they would be done in cube design. This is normally done using the GUI, which is Visual Studio called BIDS (Business Intelligence Development Studio). If you absolutely want to use a language, you could use XMLA, which is how BIDS communicates with the Analysis Services server. But this would still not be MDX, and is not very well documented, and hence difficult to learn. You could use .net and AMO, but the easiest way is the GUI in BIDS.
And some of your requirements would optimally be implemented in the design of the relational tables on which the cubes are based. The first three of your requirements are best implemented in the dimension tables, and then just used in the dimension objects in the cube definition. For the fourth requirement, you are right, this can easily be implemented in a calculated measure in the cube calculation script. And this, indeed, is MDX.
In theory, you could also implement the first three requirements somehow in MDX. But this would be complex, difficult to maintain and have bad performance. MDX is just not designed for tis type of requirement.

SSAS 2012 cube browser- how can I create columns from dimensions?

I am new to SSAS, and have created a cube in SSAS 2012.
When I browse the cube, I can easily at my dimensions as rows, but how do I add them as columns? In previous versions (I have access to a Cube created in 2008), when you browse the cube, you can drag dimensions into either columns or rows.
Have I setup my cube incorrectly?
In short: you can't any more, because the feature is no longer available. According to Chris Webb:
The cube browser has now disappeared from SSDT, and is replaced by the
control used by the SSRS query generator. This is because the old
browser used the OWC control which was deprecated years ago and
finally had to be replaced; it’s a massive step backwards because this
control is truly awful: for example you can no longer put anything
other than Measures on columns in your query.
You can confirm this by changing to design mode, and creating a simple MDX query with a dimension on the Columns axis:
SELECT
[Geography].[Country].[Country] ON COLUMNS
FROM [Adventure Works]
If I run this query in the SSAS browser, I get the error
Query preparation failed: ...The first axis [should not] reference any
dimension other than the Measures dimension"
I presume you mean the cube browser in BIDS/Visual Studio? This is generally a waste of time: it has poor functionality and regularly returns results that differ from other tools.
You would be better off using the same client tool your end users use. Excel 2010 / 2013 is pretty good.