Implicit Fact division and Dimension Usage - ssas

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.

Related

SQL Database "Operation must use an updateable query" Workaround

So my basic goal is to create a database for a shopsystem, which is my task to do for my IT course. I tried to create a UPDATE-Query, that collects all the Sale Positions ("tblPosition.PositionAnzahl") ordered with a SELECT-Query and groups it by the products ordered, to have an overview about how often each product has been sold.
I want to do this to keep track of how many items are still left in the inventory.
The Query was supposed to update 1 field ("tblArtikel.ArtikelVerkauft") in my table "tblArtikel", in which all my articles and their information is stored.
However, i just found out that you cannot run UPDATE-Queries, that use SELECT-Query data, as i get a error, that says "Operation must use an updateable query".
This is the code i used for the query:
UPDATE tblArtikel as a JOIN
(SELECT p.PositionArtikelID, Sum(p.PositionAnzahl) AS SumOfPositionAnzahl
FROM tblPositionen as p
GROUP BY p.PositionArtikelID
) p
ON a.ArtikelID = p.PositionArtikelID
SET ArtikelVerkauft = p.SumOfPositionAnzahl;
Is there another way to keep track of all the Items left in my inventory, apart from doing what i did?
Here are screenshots of the 2 tables (the depending fields are circled red):
tblPositionen with field PositionAnzahl
tblArtikel with field ArtikelVerkauft
I have not worked with SQL before and only learned about it during 45 min, so ther emight be an easy way for this, but i would still appreciate every answer from you guys.

Error in UseRelationship function

I'm here again. I'm developing an example of tabular model on Analysis Services and I've an error that I'm not able to solve.
This is my tables diagram just now:
The relevant tables are MARCHAMOS, ARFABRI and DimFecha (the top ones). MARCHAMOS and ARFABRI are joined by 2 relationships (2 fields of MARCHAMOS could be paired with 1 field of ARFABRI (depends of the situation)).
Now I'm trying to get a measure with the following DAX query:
UnidadesFrescosCompradas:= countx(
calculatetable(
filter(
marchamos;
not isempty (relatedtable('ARFABRI'))
);
MID(MARCHAMOS[REGIS03]; 1; 1) = "1";
TIPOS_COCHINILLO[GRUPO]=0;
userelationship(MARCHAMOS[REGIS28];ARFABRI[ARFA01]);
userelationship(ARFABRI[ARFA06]; DimFecha[Fecha])
);
[regis01])
As you can see, I'm telling the system the relationships that it must use (one of them is from MARCHAMOS to ARFABRI and the other one is from ARFABRI to DimFecha). But I get this error:
If I remove the "userelationship(ARFABRI[ARFA06]; DimFecha[Fecha])" caluse of the filter, the error disappears, but the result is not correct.
I don't understand this, since both relationships are not over the same tables.
Any hint?
Thank's in advance
You can USERELATIONSHIP with both active and inactive relationships. It looks like you have an ambiguity in that you have two eligible relationships for MARCHAMOS and ARFABRI.
Since the ending point column for ARFABRI is the same in both relationships you get the error.
Can you delete the inactive relationship?

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)

SSAS dimensions hierarchies: A duplicate attribute key has been found when processing

I am completely new to SSAS an I am trying to deploy a simple cube with only one dimention comprised of multiples attributes. What I did already was to create a DSV from my data source and then I created a dimension from my fact table. It seams that no matter what happens, I get the following error message:
Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'dbo_Fact_Statistics', Column: 'Team', value: 'ANA'. The attribute is 'Team'.
This is my hierarchy: Id (SK) -> Player id -> Team -> Player Name -> Salary
I don't understand, obviously the problem is not that the value is null, like I've seen in other threads, telling me to set NullProcessing under KeyColumns to something else than automatic, but this is not the problem in this context.
Any help would be greatly appreciated.
Probably you have Team ANA listed under multiple Player Names and/or Salary values.
This is a really tricky area of SSAS. The quickest way forward is probably to install BIDS Helper and use the "Dimension Health Check" function:
http://bidshelper.codeplex.com/wikipage?title=Dimension%20Health%20Check&referringTitle=Documentation
It will show you all the issues in your data (not just the first one which you have discovered so far) and give you some info on how to proceed.
Personally I've gone off building attribute relationships due to the difficulty of debugging and fixing these issues. I tend to build dimensions now where every attribute relates directly to the key attribute. You never see these errors and performance seems very similar. You can still present the users with hierarchies.
If that is not an option for you, then you could try adding the columns for the higher-level attributes to the Key property of all the lower levels. Technically this will work but it is awkward to set up and maintain.
This approach solved my problem:
Instead of having the attributes following chained relationships, I simply leave the relationships as they were by default.
Player id (SK) -> Conference
Player id (SK) -> Division
Player id (SK) -> Team
Player id (SK) -> Player Name
Player id (SK) -> Salary
run this in sql find your douplicate for example ID... used it as my dimension key
Select id,count(*) as how_many
from [RC_Dailer_WH].[dbo].[RC_call_logs]
group by id
having count(*) > 1
(3647 row(s) affected) of which there are more than 50k records in my DB
removed duplicates then my cube processed proper
go for that dimension on which it is showing error.
and right click
go for view code
and search for the below line in that code:
ReportAndStop
delete that XML tag
and save
and reprocess it will works
Go to dimension for which it is showing Error. and give right click - go to view code -
CTRL+F - sarch for Connection - find
ReportAndStop
connection String.
Delete the above Command from the Code – and Save.
Process it again.
It will work.

SQL OLAP Cube and dimension

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.