I have created Dimension - Vendors,Distributors and Time
And I have Fact tables Purchase and Total Paid Amount.
I have also set below properties for Dimension :
UnknownMember : Hidden
and for the Key Column Property
NullProcess : Error
I have also done properly Attribute Relationship on the Cube. So that it is giving me proper result as below.
It is showing values without Unknown Members.
Now, On my report I have put the slicer for the Venders.
And it still shows Unknown as a member. I don't even have any null key in any table.
Anyone has any idea, how to get rid of this unknown member with Best Practices?
I am using SQL Server 2012 with Latest NU update. So that I can create Power View reports using connection on sharepoint site.
Thank you,
Related
Platform: SQL Server Analysis Services 2016 RTM and later (Multidimensional)
In the database we have the following dimension of companies:
Company
The parent-child hierarchy does not loop but it’s ragged. The graph looks as follows (treant-js drawing):
Company parent-child graph
The Analysis Services project contains only one dimension - Company, created using the wizard. All settings are set with default values. “CompanySK” is the KeyColumn and “CompanyName” is the NameColumn. “CompanyParentSK” was renamed to “Company Hierarchy” and Usage was set to “Parent”, which indicates this attribute holds parent id. Nothing unusual:
Dimension in Visual Studio
The project is always loaded and processed without problems.
The hierarchy works and is represented correctly in the tree viewer.
Now if we will try to query the dimension using MDX just like Reporting Services is doing - strange things are happening..
When you try to list all Companies where “Country Name” is “Germany”:
WITH
MEMBER [Measures].[ParameterCaption] AS [Company].[Company Name].CURRENTMEMBER.MEMBER_CAPTION
MEMBER [Measures].[ParameterValue] AS [Company].[Company Name].CURRENTMEMBER.UNIQUENAME
MEMBER [Measures].[ParameterLevel] AS [Company].[Company Name].CURRENTMEMBER.LEVEL.ORDINAL
SELECT {
[Measures].[ParameterCaption],
[Measures].[ParameterValue],
[Measures].[ParameterLevel]
} ON COLUMNS ,
[Company].[Company Name].ALLMEMBERS ON ROWS
FROM [HierarchyErrorCube]
WHERE STRTOSET( "{[Company].[Country Name].&[Germany]}" );
it returns an error:
Executing the query ...
Internal error: An unexpected exception occurred.
Run complete
BUT if you will ask for Australia:
(...)
WHERE STRTOSET( "{[Company].[Country Name].&[Australia]}" );
it just works.
Few interesting facts:
If you will remove/comment [Measures].[ParameterCaption] from the selection - query starts to work,
if you will disable “Company Hierarchy” by changing it back to regular attribute - query starts to work,
removing the filter (WHERE) makes the query working,
so as you can see - even if “Company Hierarchy” is not a part of any query listed above, it affects somehow the engine and fails the query when it comes to retrieving CURRENTMEMBER.MEMBER_CAPTION on “Company Name” attribute when another attribute - “Country Name” - is filtered. And not for all filtered values, but we couldn’t find any pattern here (for example if country level affects somehow).
Using SQL Server Profiler (with enabled all events in capture scope) and sniffing one of the failing queries, it is clear, that the error is appearing during last phase of getting members - exactly for CURRENTMEMBER.MEMBER_CAPTION.
You can download the project and data here on my blogpost.. You can also find there all the ways that we've tried to resolve this issue.
Is it there any setting in Visual Studio project that can help or maybe the Reporting Services MDX code is wrong? Any help would be appreciated.
I have removed an attribute from a dimension (edited a view that feeds my dsv) because it is not wanted/needed anymore.
Now when I try to process that dimension, i get the following error;
OLE DB error: OLE DB or ODBC error: Invalid column name 'EngNation'.; 42S22.".
EngNation being the attribute i have deleted.
Why is it trying to process a column that doesn't exist anymore? I have refreshed the dsv and the column isn't there anymore. I've even gone through the xml-code but can't find a trace of the attribute anywhere. I just don't understand what else I have missed.
I've tried searching the web but have not been able to find an answer to my problem, any input much appreciated.
There is an update that fixes this:
https://support.microsoft.com/en-ca/help/2897265/fix-invalid-column-name-error-when-you-run-some-mdx-queries-against-ro
But if you are in a position where you cannot apply the update for whatever reason, you can see if you scenario matches ours and I will explain how I got around this error:
Three fact tables (views)
- Budget (derived from a view from an application)
- Actuals (derived from a view from an application)
- Forecast (derived from a view from an application)
Two write back tables for Forecast and Budget.
Two Dimensions
- Time
- Account Hierarchy
Three Measures:
- Actuals
- Budget
- Measure
Originally, I had three measures on each of the fact tables (views) that were Budget, Actuals, Forecast (think three views that are pretty much the exact same with three measures). When I made it so that only the actuals view had an actuals measure, the forecast view only had a forecast measure, and the budget view only had a budget measure, everything seemed to work.
The missing column error is very misleading as the column and relationship was fine.
The cube (sql Server 2016) contains dimensions [Unit].[Unit].&[1] and [Unit].[Unit].&[2]. I’ve created a calculated dimension:
CREATE MEMBER CURRENTCUBE.[Unit].[Unit].[All].[1/2] AS [Unit].[Unit].&[1]/[Unit].[Unit].&[2]
To restrict access to the dimension of [Unit].[Unit].[All].[1/2] I’ve created the Role.
But I can not select [Unit].[Unit].[All].[1/2] in DimensionData-Basic tab, because this attribute does not appear in the list of attributes.
If I specify the attribute [Unit].[Unit].[All].[1/2] in DimensionData-Advanced tab in the MDX-script Denied member set: {[Unit].[Unit].[All].[1/2]}, the user sees this attribute.
How do I restrict access to the calculated dimension?
If you change your DimUnit SQL table to include a "1/2" row then replace your CREATE MEMBER statement with the following it should work the same and you should be able to see this member in dimension data security after you deploy and process the cube:
([Unit].[Unit].[1/2])
= DIVIDE([Unit].[Unit].&[1], [Unit].[Unit].&[2]);
Then after you have created a role that makes the 1/2 member disappear you will get an error when browsing the cube with that user. Change the above line to the following:
(IIf(IsError(StrToMember("[Unit].[Unit].[1/2]",CONSTRAINED)),Head([Unit].[Unit].Members,0),StrToMember("[Unit].[Unit].[1/2]",CONSTRAINED))
= DIVIDE([Unit].[Unit].&[1], [Unit].[Unit].&[2]);
BTW, DIVIDE does safe divide so divide by zero won't cause problems.
Off the top of my head I can't recall if StrToMember is necessary vs. just a member reference so I played it safe. Feel free to try it without StrToMember.
To be clear the whole script should say:
CALCULATE;
(IIf(IsError(StrToMember("[Unit].[Unit].[1/2]",CONSTRAINED)),Head([Unit].[Unit].Members,0),StrToMember("[Unit].[Unit].[1/2]",CONSTRAINED))
= DIVIDE([Unit].[Unit].&[1], [Unit].[Unit].&[2]);
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)
Is there a way to access system tables in a SSAS cube calcuation?
For example the following query can be executed on a SSAS cube to return a last processed date:
SELECT LAST_DATA_UPDATE FROM $System.MDSCHEMA_CUBES WHERE CUBE_NAME = 'Cube'
How would one access this information in a calculation?
Background: We were using ASSP before (a third party sproc) to get the last cube processed date. Recently, this sproc threw an exception on one of our cubes and caused SSAS to go down. Using the above line of MDX did not have this behavior. I would rather not have our cube depend on third party code so I am looking for a way to access LAST_DATA_UPDATE in a calc for a specific cube name.
I usually include a detached Dimension in my cubes e.g. ".Cube Information" which includes attributes like this. Other useful attributes could expose the currency of the data e.g. when did the last underlying ETL process complete, or the release/build of your cube.
I feed this "Cube Information" dimension from a SQL view which returns a single row with whatever data is needed - you could use your SELECT statement. It also needs to return a Key column with a fixed value e.g. 1.
By "detached" I mean the "Cube Information" dimension has no entries in the Cube Dimension Relationship tab.
In the cube Calculation script, I assign the DEFAULT_MEMBER property for that dimension to the fixed Key value from the SSAS view.
Any client tool can then access those Dimension attributes.