Adding a dimension to a SQL Server cube inflates all measures - ssas

I have a SSAS cube that has worked fine for a while. I recently added a new dimension and now all the measures are vastly inflated. For instance, a count that should be about 300,000 for the whole model (i.e. with no filters at all) is now 1,500,000. All the measures I have checked are affected. The measure values are always way too high, but not be any consistent factor (i.e. some are 5 times too big, others 10 or 20 times too big). The errors are present whether or not the new dimension is included in the query.
I went back to a previously working version and tried again, making sure that the only changes I made were:
Add a new table in the dsv
Create a new dimension based on that table and add it to the cube
Define referenced relationships in the dimension usage matrix to link the new dimension to the measures via one of the other existing dimensions
My caution didn't pay off -- the second attempt gave the same result as the first, which points to a conceptual or design problem. Any ideas where I might look for my mistake?
More Details
The cube structure is as follows, with the recently added Church table highlighted:
The cube has many measure groups, but since all seem to be adversely affected by the introduction of this new dimension, I'll focus on just the one labeled "cm". We are a charity organisation that raises money for children in poverty around the world. "cm" represents a financial commitment that a supporter ("con" means "constituent") makes to child in need. Analysing the number of commitments by various con attributes has worked fine for a long time. We can also successfully analyse cm's by attributes in constituent_address via a referenced relationship.
Since most of our constituents belong to a church of some form, we wanted to add church details to the cube (e.g. church name, church size, denomination). We could then, for instance, count the number of commitments made by constituents who belong to Baptist churches. I added the Church table, and modified the con named query to include a church_id. (I also checked that the new con query returns exactly the same number of records as the old one, so I don't think the ensuing problem is caused by the con table changing.)
Here's an extract of the dimension usage matrix:
And here is a before and after example. The first shows the correct count of commitments before the Church dimension was added. The second shows the same measure, built from exactly the same data, with the only changes to the cube being the addition of the Church dim. As you'll see, the new Church dimension is not explicitly included in the query but the measure now shows a commitment count of 1,574,823 rather than 315,057.
--Matt

Related

Wrong SUM calculations in OLAP cube

I'm pretty new to SSAS and i have encountered a quite odd issue. The simple SUM function in OLAP cube shows wrong numbers based on the dimension usage.
I have created simple OLAP cube in SSAS, which tracks fuel payments across company car fleet. Data source is a SQL database server, and I use table "purchase" (contains information of amount of fuel bought, paid price, location of purchase etc.) as a measure and tables "car" (information about car type, its registration ID etc.), "location" (plant location the driver originates from) and "division" as dimensions.
When I first connected all dimensions to the measure on the "Dimension usage" tab, I got wrong sum of the price paid and amount of fuel bought - the sum displayed was much lower than the actual one. I tried to look into it and the numbers were wrong as well if i looked at the data by division, location etc.
But when I used the "Car" dimension and created table showing the data for each individual car, the results were correct, which I find weird.
When I disconnected the "Car" dimension from the measure group, the totals in the cube were correct, but i was (of course) unable to look at individual numbers for each car.
I understand that there is some problem with the "Car" dimension, but I am unable to find out what exactly goes wrong. Any advice helping me to identify where to look would be much appreciated. Thanks in advance.

SSAS OLAP Cube - Sum measure only works when keys are present

(This is a mock of my actual setup to help me figure out the problem.)
I have one fact table and one dimension table, linked by an id field.
My goal is to make a measure that sums up all "thing_count" (integer) values in my cube.
If the user splits by nothing, it should show the total "thing_count" for all records in the fact table. If it's split by "category_name" from the dimension, it should show the total "thing_count" for each category.
I tried to achieve this by creating a SUM measure in my cube:
It works, but not in the way I intend it to
It always shows (null) unless I drag in the "id" field from the dimension.
Measure only:
Measure and category:
Measure, category, and id:
How can I make the measure show the value without keys needing to be present?
Edit:
For GregGalloway's request (I've edited the names so the screenshots are easier to follow):
One common explanation for this behavior (no aggregation) is that you have inadvertently commented out the CALCULATE; statement in your MDX script in the cube. Please check that statement is still present.

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.

Managing PerformancePoint Filters With Slowly Changing Dimensions

Just a bit of background info:
I have dimension table which uses SCD2 to track user changes in our company (team changes, job title changes etc) See example below:
I've built an Analysis Services Cube and created all the necessary hierarchy's for the dimensions and it works well when navigating and drilling down through the fact table.
The problem I have is with the filters on the PerformancePoint dashboard. As I'm using the User Dimension table with it's multiple instances of users it's showing duplicates up in the list. I can understand why as the surrogate ID is being referenced on the Dimension. But if I choose the first instance of the A-team I will see all their sales for a particular period and if I choose the second instance I will see all their sales for a different period.
What is the best way to handle this type of behavior? Ideally I'd like to see a distinct list of teams in alphabetical order and when I choose the team name it shows all of their data over time.
I've considered using MDX query filters but I'd like to see if there's anything I haven't thought about.
I realise this isn't an easy and quick question but any help would be appreciated!
The answer was simple after having a trawl through my User Dimension table on the Cube.
Under my user dimension I added 2 duplicate attributes to my attributes list ("Team Filter" is a copy of "Team", "User Filter" a copy of "User Name") these will be used only for filtering the dashboard.
Under the attribute properties for each duplicate I then set AttributeHierarchyOptimizedState to "Not Optimized", I also set their AttributeHierarchyVisible to false as I'd shown the two duplicate attributes in the hierarchy window in the middle.
Deploy your Cube to the server and go in to PerformancePoint. Create a new MDX Filter (this image shows the finished filter)
This is the code I used, it only shows dimension members which have a fact against them (reduces the list a considerable amount) and by using allmembers at the dimension it also gives me the option to show "All" at the top of the list.
Deploy the new filters and now you can see the distinct list of users and teams, works perfectly and selects every instance (regardless of the SCD2 row)

display always the right MDX (sub)total in the client-application (eg Excel)

I can't figure it out! (CustomRollUpColumn??, or some custom made MDX calculated thing)
My problem: I have a dimension TypeOfRow who's function it is to display the ... well yes ... type of row. I'm working in the financial sector and, always, need to provide the ultimate result ==>> The Total Contribution. I read, amongst others, the article of Martin Mason ( http://martinmason.wordpress.com/2012/02/26/the-ssas-financial-cubepart-1ragged-hierarchies/ ) and designed the dimension as a "Naturalized Parent-Child Hierarchy".
The dimension, 5 levels, I designed for this solution is (simplyfied):
•+/+ Revenue (several types of)
•-/- Cost (several types of)
•= Total Contribution
A user requirement is that the "Total Contribution" always display the "Total Contribution" even if any the Revenue- or Cost types are filtered out.
My question: is this possible showing the total of a dimension without showing all the members (in Excel but I hope to configure this in SSAS 2008R2)?
many thanks in advance, - Leon