I've got a cube, I can fetch all other member properties using CurrentMember.PROPERTIES("property name")
But the property that's named "KEY ID" simply returns that member's key value.
This query gets me KEY of the property:
WITH
MEMBER [x] AS
[Product].[UPC].CurrentMember.PROPERTIES("KEY ID")
select
[x] on COLUMNS,
[Product].[UPC].[UPC] on ROWS
FROM [my_cube]
If pull out KEY ID as a dimension, it gives me KEY ID's correct value.
Like this:
select
[measures].[sales units] on COLUMNS,
[Product].[KEY ID].[KEY ID] on ROWS
FROM [my_cube]
What's more, I was making random changes to my query and found that the gibbery of [Product].[UPC].CurrentMember.PROPERTIES("KEY asdf") gives me value of KEY as well.
I searched MSDN and did a bit googling, but cannot find any documentation saying that "KEY ID" (or "KEY XXXXX") is reserved, or "KEY ID" is interpreted as "KEY". Does anyone know of any explanations?
Here is MSDN documentation concerning properties:
http://msdn.microsoft.com/en-us/library/ms144821.aspx
Another way to get the Key as an integer is:
WITH
MEMBER [x] AS
[Product].[UPC].CurrentMember.Properties('key0', TYPED)
select
[x] on COLUMNS,
[Product].[UPC].[UPC] on ROWS
FROM [my_cube]
Unfortunately I'm unable to help with a specific answer to your question but maybe the above helps a little.
Related
I have a requirement where report should show measures as "not applicable" if one selects a attribute which is not linked to that measure Group.
1) unrelateddimesnion= 'false' is not solving my problem because i have few default members.
2) I could able to show measure value as "not applicable " by Writing this MDX statement
([Customer].[customer name].[customer name], [measures].[sales forecast]) = 'not applicable'
but with this i have to repeat the same line for each and every attribute present in the dimension ( and also for each and every measure present in the measure Group)
can someone help me Writing the MDX for entire dimension instead for individual attribute. Thanks in advance.
Kind Regards
Mah
Bad news! An MDX script on your cube can't reference such a sub-cube in a simple way. You may have seen the LEAVES(dimension) function for a scope statement but that won't work when one attribute in a dimension has the [All] level and another has a selection. (That is to say the function returns the leaves of the dimension's key attribute). What you can do is use nested scope statements with the outer one filtering down to the list of measures you want to affect. That will at least save you typing a formula num_attributes * num_measures times. The scope statement may even accept the MEASUREGROUPMEASURES function. (When I last used that it only returned visible measures but that's probably what you want anyway.)
It may be easier to link measure group and dimension and let your data sit on the UNKNOWN member. (Or an explicit dummy member.) Then filters against or slices to real customer hierarchy values will exclude your [Sales Forecast] rows and show it as null. That's not something I've done and it'll have ramifications for error processing and you'll have to allow users sight of the unknown or dummy member. So recommend you play with the idea before you rely on it.
I hope this helps some.
I am very new to SSAS Cubes, and do not know MDX.
I need help in creating a calculated member. The dimension attribute that I am using in the calculated member calculation, is renamed, and that is why the calculation is not working.
I have a dimension named "IN" in the cube, and I am trying to count the "CounterKey" in the measures group when the value of attribute "C 1" in the "IN" dimension is 1.
I used the calculation below and it worked fine.
([Measures].[CounterKey count],([Dim IN].[C 1 Top Box].&[1]))
I had to rename "C 1" to a more user friendly/descriptive name i.e. "Courtesy TB". After changing the name, I made the change in the calculated member as below as below
([Measures].[CounterKey count],([Dim IN].[Courtesy TB].&[1]))
but the calculation is not working any more, and I am just getting a null as a result.
Any help will be highly appreciated.
It seems this is the wrong renaming or something else. Try to drag'n'drop the member from your cube and insert into the formula. Will the following return the null?
[Dim IN].[C 1 Top Box].&[1].UniqueName
If null, it means the member doesn't exist any more within a cube. It's a naming issue.
Suppose I have a dimension DIM_Users with two attributes UserId [bigint] and Reputation [int]. In this case I can successfully process the table.
But, after I add DisplayName [nvarchar(255)] attribute to the dimension, processing fails with the next message:
Errors in the OLAP storage engine: The attribute key cannot be found
when processing: Table: 'cube_DIM_Users', Column: 'DisplayName',
Value: 'Justin ᚅᚔᚈᚄᚒᚔ'. The attribute is 'Display Name'.
Comparing the screenshots I've noticed that the first time 5987286 UserIds were processed (which is the correct value), but the second time only 70000.
And also I see that the value "Justin ᚅᚔᚈᚄᚒᚔ" looks strange, but I can't figure out how it can affect processing of the Attribute Key.
Any ideas about what's wrong with my dimension?
I've found this article but it doesn't help.
It seems this problem is caused by a collation mismatch between your data source and ssas. You will get a better understanding for possible collation issues if you fire a sql select like SELECT DISTINCT UserId FROM yourTable WHERE UserId LIKE 'Justin%'. There should be more than one entry, which potentially causes collation issues.
Please try the following workaround, if your attribute "User Id" is unique. Add an artificial unique key for each UserId row to your dimension table, e.g. an incrementing integer. Assign this created key to the key column of your attribute and assign your "UserId" to the name column.
Hint: If you expand the key column properties of an attribute in a ssas dimension, you can also change the collation ssas is using for processing. I've tried this in the past but sometimes it didn't resolve collation based issues for me.
I have a test cube with one dimension and one fact table.
Superbill Key on Fact Superbill references the Primary Key on Dim Superbills.
On my Fact Superbill measure group I have several measures, including one which is a Fact Superbill Count. Based on this measure, I create a calculated member called Generated Superbills as follows:
([Measures].[Fact Superbill Count], [Dim Superbills].[Is Void].&[No])
On the cube browser I create the following query that returns only one SuperbillKey, including the Fact Superbill Count and Generated Superbills. The results show the correct value for Fact Superbill Count (which is one since I am only getting one Superbill), but Generated Superbills show 23.
What am I doing wrong? Both should return 1.
I am not sure why it was not working, but I was able to find a solution for this. Superbill Key on DimSuperbills had a Key Value and a Name Value (the name value was not unique). I removed Name value and left only they key. I ran the MDX query after these changes and it worked.
I have a cube with some dimensions. There I have a dimension 'Product' which has some attributes and user defined hierarchies hidden. I do not know which attributes are hidden.
Is there a way to write an MDX to get the invisible attributes and user defined hierarchies?
I can get the name by other ways. But I want to know the way to get using MDX.
http://msdn.microsoft.com/en-us/library/ms145613.aspx gives an example query that reveals a member property:
WITH MEMBER [Measures].[Product List Price] AS
[Product].[Product].CurrentMember.Properties("List Price")
SELECT
[Measures].[Product List Price] on COLUMNS,
[Product].[Product].MEMBERS ON Rows
FROM [Adventure Works]
I cannot test it myself right now, but I assume that you could also write .Properties(0) or .Properties(1) to refer to properties by index, since you don't know the names. I'm not sure if there is a way to then discover the property name from the resulting cellset or not, sorry.
I'd start with looking into the DMVs for this, as you're really after metadata, not data.
http://dwbi1.wordpress.com/2010/01/01/ssas-dmv-dynamic-management-view/
They look like SQL, but run in the MDX window of SQL Management Studio, so will also run in an MSOLAP connection.
SELECT * FROM $system.mdschema_properties
That looks to be the query, a full list of members and a column identifying which are visible.
See how that works out for you.