SQL OLAP Cube and dimension - ssas

In a windows Server 2008, using SQL server 2005, Visual Studio and SQL Server Analysis Services i created an OLAP Cube.
The scenario is a typical store with sell products, customer and agents.
The cube is made by a fact table tblVendite (sell data) and dimensions based on sql views.
NOTE: I tried embed the screenshot here but they will resized and will not clear so i posted them in a safe site to view it:
SCREENSHOT: stucture of the cube
FACT TABLE tblVendite (sell) > PK: CdArticolo (IDProduct)
DIMENSION Prodotti (produtcs)
DIMENSION Calendario (calendar)
DIMENSION Agenti (agents)
DIMENSION Clienti (customer)
Browsing the cube with basic filters as calendar, customer/agent, products, brand ... all work fine
Now i need to provide a new feature as:
Comparing the "top sell brand" of all company with the sell of each agent to see how he sell those brand
So i did a new table and the related view: vwMarcheOrd (top sell brand)
The table top sell brand is pre-populated by a sp and contain 1 record for each brand (CdMarca - Position - Description order by Position)
NOTE: from vwMarcheOrd i cant have direct link to the fact table because the PK is CdMarca and it's not present so i need to "bridge" the view Products by CdMarca and get the CdArticolo to link the fact table
Dimension and the attributes for Brand and Top Brand:
SCREENSHOT: cube dimension
BROWSE THE CUBE AND THE PROBLEM
Adding the dimension Brand(1) to the row fields the result is correct but if i add the Top Brand(2) is incorrect and many brand are missing (but they exist)
SCREENSHOT: browse Top Brand
So my questions are 2:
What i missing or wrong or misunderstand with the Top Brand Dimension ?
How i can display all records of Top Brand in the row fields even if the agent didnt sell any item of that brand (blank row) ?
p.s. i tried also make a dimension based only with vMarcheOrd and then create a Referenced Relationship with the Product table to bridge CdMarca > CdArticolo > Fact Table but the result are the same
Thanks in advance who can really help me to solve this problem that block me since many days

From what I understand, it looks like the top brand could change over time. This means that you would need to somehow track that over time. In my opnion, the easiest way to do that would be to add the TopBrandKey to the fact table and join the top brand dimension directly to the fact table. This way the time tracking is done for you in the fact table. As new records come in, you would look up the key for the top brand and add that to the fact table. I don't think the way you have it would work because the product which was sold would not have the brand which is the top brand (those are two different things).

ciao luka :)
it seems to me that you don't have the proper attribute relationship between the attributes on your cube.
I see you are using BIDS 2005, which I'm not very familiar with it (it would be easier to help on 2008), but what you have to do is set the relations between Prodoti -> Brand -> top brand
you can do that by those + signs on the attributes bellow the dimension name.

Related

referenced relationships sql server analysis Services, How can i create it

enter image description hereI'm beginner in SSAS, actually I work on SSAS Olap cube I have an issue which is I can not add customer fields to charge dimension or to charge fact (to be displayed on power bi )
Thank you in advance
The general answer is:
Add dimension to the cube
Open "Dimension Usage" tab
Click on a cell crossing Measure Group vs Dimension
Use "Referenced" type and select another dimension as a Reference
But please provide more details:
What have you tried before asking a question here?
Why it didn't help?
What are you trying to achieve (with simple example in Excel, plain text etc.)? Like Customer: A,B,C, Charge: X,Y,Z. Their relations. What is your expectation.

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)

Modeling products pricing structure

I need to model a rather complex pricing structure for some of our products.
Today we lookup the prices manually. Here's a picture with explanations of the "matrix" that we use today: Sample model (sorry for the link - but I'm not allowed to post images because I've just opened my account.)
Now I need to transfer this model to a RDBMS system (SQL Server 2008 R2). The entry point when looking up a price is the Category, then the yearly interval and finally the interval depending on how many products we're selling on this order. The result of the query should be two prices.
Do you have any suggestions on how to model this? I was thinking of modeling it as a matrix with a RowNumber, CellNumber and a CellValue. But then I need another table for describing what is contained in each cell (by referencing the row and cell numbers). If doing that, I could just include the prices in that description table. But that doesn't seem like the best solution.
Do you have any hints/solutions on how to model this problem the best way?
I think I would make something like this:
Categories are separated into its own table.
Each row in the price table are uniquely identified by the category and starting point of the sold and shipped range. I don't think you would need to specify ending point in the table (since the end point of a range should be the starting point of the next range minus one).
Edit: With this model, you will need to add a row in the Prices table for each combination of category, units sold-interval and units shipped-interval, but right now I can't think of an easier way.

Implicit Fact division and Dimension Usage

I have a star schema with Implicit Fact division as shown in Figure 5 at http://www.information-management.com/infodirect/20020308/4858-1.html?pg=2.
My question is how do I set up the Dimension Usage? My first thought was to set up 3 Referenced Relationships (CustomerGroup to InvoiceItemFacts, GroupToCustomer to CustomerGroup, CustomerDimension to GroupToCustomer), but when I try this I get the message "A loop was found in the data source view at the 'dbo_CustomerGroup' table".
Update:
I have found that if I create a Regular Relationship between GroupToCustomer and InvoiceItemFacts (effectively by passing the CustomerGroup table because I already have the Customer Group Key) I can get some results. However, when I browse the cube and display the InvoiceItemFacts by Customer, the InvoiceItemFacts only display on the first Customer in the group.
GroupToCustomer looks to be a "Fact-less Fact Table", so you would create a measuregroup on that, doesn't need to be visible to the end users, then do a Many-Many join via that fact in the dimension usage tab.
It's a little complicated by the extra table in the way, but that should be the approach.