Analysis :: How To Get Dimension Key Attribute In MDX
Apr 30, 2015
Many dimensions don't have unique members. Instead, the dimension source data has duplicates at the leaf level: it's left up to SSAS to aggregate up to the actual leaf level used in hierarchies.
Every cube I've worked on in the past, a dimension is clearly defined in the source data, with uniqueness already present there: we don't make a dimension out of duplicated, sort of facty data. This kind of design seems as weird to me as an unnormalised SQL database.
Here's an example to illustrate what I mean; I'll use that Adventureworks database.
We have a Geography dimension with a Geography hierarchy. Levels go like this from top to bottom:
Country
State-Province
City
Postcode
The Geography dimension has a key attribute called Geography Key. It's there in the cube design as a dimension attribute, but it's not in any of the hierarchies, so I can't query it in MDX. But that's fine: it has the same cardinality as the lowest level (Postal Code), because the dimension has some kind of normal design.
In the cube I'm dealing with, it's all messed up. Using the AdventureWorks example above as a parallel, someone made a Geography dimension with source data keyed on [PostalCode, ExactAddress], but only wanted the dimension granularity to be PostalCode.
This makes it very hard to debug why the data in this dimension is incorrect. I can't match up the dimension members in the cube to the source data, because the dimension doesn't actually go down to the real leaf level!
So I have a dimension attribute called ExactAddressKey, but I can't query on it in MDX, because it's not part of any dimension hierarchy. Unfortunately changing any part of this cube design is not possible, so I can't even experiment with settings and see what happens.
How I could get to the leaf level of the data imported? Something like
Geography.Geography.TheInvisibleLeafLevel.Members.Properties('Key')
Or does this kind of dimension design result in SSAS discarding all the data that's more granular than the most granular attribute defined in any hierarchy - so that the data actually isn't there to be queried?
View 2 Replies
ADVERTISEMENT
Sep 8, 2015
I have 2 dimensions that pull their Facility Name from the same Location Dimension. The business users want to change Facility Name in the Material Facilities dimension to “Material Facility Name”, but keep Facilities dimension attribute the same. What is a good way to go about completing this task.
View 2 Replies
View Related
Jun 4, 2015
I am unable to find solution for the problem while writing a Named Set in my cube.
I have a calculated measures which gives me difference in Sales in PERCENTAGE (%).
When I try to filter out those product codes which went a less than 5 %, I get no records.
I have also tried to filter direct values lets say - Products with sales > 100000 which is working fine.
Following is sample of my Named Set
FILTER([X].[Products Code].members, [Measures].[Diff in Sales]<5)
I believe as the values are in percentage, I am facing this issue.
View 21 Replies
View Related
Jun 30, 2015
I have a cube with a fact table and 3 dimensions. One of the dimensions is a type 2 and surrogate key is stored in fact table. If i query the database, the dimension attributes display correctly, however the cube is always displaying the latest dimension attribute and not preserving the history.
The measures are correct for the time period displayed, but the dimension attributes always show the latest values.
View 3 Replies
View Related
Jul 15, 2015
In my SSAS Cube I have created a dynamic named set "top 10 e-learnings by language" which consists out of a set of tuples. Each tuple has two attributes out of the same base dimension "training": attribute 1 is "sprache" (language) and attribute 2 is "training text".
CREATE DYNAMIC SET CURRENTCUBE.[Top 10 eTrainings pro Sprache]
AS Generate(
{ [Training].[Sprache].[Sprache].Members },
TopCount(
EXISTING { [Training].[Sprache].CurrentMember * [Training].[Training Text].[Training Text].Members },
10,
[Measures].[Teilnahmen eTraining]
)
), DISPLAY_FOLDER = 'Training' ;
Normally a named set would be automatically visible in Excel Pivot under the dimension you used to create the named set, but it seems that named sets with tuples which have more than one attribute are placed in a separate folder "Sets" in between the measures and dimensions.Additionally in the SSAS cube browser this named set is not visible at all.Is there any way to tell the named set in which dimension it should appear or any workaround?
View 2 Replies
View Related
Jun 2, 2015
I have a dimension report with an attribute reporttype which have different member let say A,B,C,D....etc.
I want to set more than one default members for dimension report.
I've read all about how dimensions can have only one default member, but I need to set more than 1.
View 2 Replies
View Related
Jun 15, 2015
I am trying to implement data masking based on user login and not sure why this is not working. I have the dimensions DimBrand, DimProduct and DimUser. I should mask the BrandCode with 'XXXX' nothing but in the report all the BrandCode should appear but few of the code will be masked if the user is not belongs to that group. I have a fact table FactProduct in this. In the cube I created all these 3 dimensions and the fact table. I created a new dimension DimBrandMask and I separated the code over there with a relationship with the actual DimBrand dimension. In the cube a reference relationship is set up with the measure group. Created a role with read access.
In the dimension data tab of role I put the below MDX to allowed set.
NonEmpty([DimBrandMask].[Brand Code].Members, (StrToMember("[DimUser].[Login Name].[Login Name].[" + UserName() + "]") ,[Measures].[Dim User Count]))
And in Denied Member set i put the below MDX
IIF( (StrToMember("[DimUser].[Login Name].[Login Name].[" + UserName() + "]"), [DimUser].[Access Right].&[False]), NONEMPTY( [DimBrandMask].[Brand Code].Members,(StrToMember("[DimUser].[Login Name].[Login Name].["
+ UserName() + "]"), [DimUser].[Access Right].&[False], [Measures].[Dim User Count])),{})
Note I created one measure group from the DimUser table and the measure [Dim User Count] is used in the above query.
I am expecting some result like below
Brand BrandCode Count
Brand1 b1 6
Brand2 XXXXX 5
Brand3 XXXXX 10
View 9 Replies
View Related
Oct 26, 2015
When i add a dimension to the cube dimension without any relation in my dimension usage to any measure group my units are going down.However when i remove the dimension from the cube am getting the correct values.
View 4 Replies
View Related
May 21, 2008
Hello SSAS gurus,
Recently i started learning working on Analysis services and writing MDX expressions, so please forgive my ignorance if this is a trivial question.
I ran out of s. Don't know what I should do to fix this. Please point me in the right direction.
We have a cube with one fact table(Imperative Fact) and two dimensions (Client, Client Imperative). A Client has several Imperatives. One of the attributes of Client Imperative dimension is Target Outcome. This is a text field.
We created a measure Client Imperative Count that gives the number of imperatives a client has.
The business defined 'Client Imperative' KPI as following :
If client has 1 or more imperatives and has Target outcome then show green. If client has 1 or more imperatives and does not haveTarget outcome then show yellow. if the client does not have imperative then show red.
Wrote the following KPI Status expression but it doesn't seem to work. Hitting a dead end. couldn't figure this out.
Code Snippet
Case
When
[Measures].[Client Imperatives Count] > 0
And
([Client Imperatives].[TRGT OTCM].currentmember <> null)
or
(Not IsEmpty([Client Imperatives].[TRGT OTCM].currentmember))
Then 1
When
[Measures].[Client Imperatives Count] > 0
And
([Client Imperatives].[TRGT OTCM].currentmember = null)
or
(IsEmpty([Client Imperatives].[TRGT OTCM].currentmember))
Then 0
Else
-1
End
Tried [Client Imperatives].[TRGT OTCM].value but didn't work.
Also, tried to create a calculated member for Target Outcome using following code. It is not working either.
Code Snippet
CALCULATE;
CREATE MEMBER CURRENTCUBE.[MEASURES].[Target Outcome]
AS case
when
[Client Imperatives].[TRGT OTCM].currentmember = [Client Imperatives].[TRGT OTCM].&[]
then 0
else 1
end,
VISIBLE = 1 ;
Trying to figure this out since two days. Somebody please help me.
I appreciate your help.
View 3 Replies
View Related
Dec 19, 2005
Hello
I am a newbye with Analysis Services and am desperately trying to find a way to include a calculation between one of my measures (Teus), divided by the vessel capacity, where vessel is one of my dimensions (and is therefore not depended on other dimensions...)
Any ideas how I could implement that ?? This would help a lot, thanks for your help,
Aurore Bui.
View 2 Replies
View Related
Apr 7, 2008
I have date and float in attribute in a dimension table. If deploy my cube and I try to create a report with RS, I can't format this data. The value seems to be a String so I have to do a CDate or a CDbl before formating it.
I have no problem when I try to format my measures.
Thanks for your help.
Cheers,
View 15 Replies
View Related
May 21, 2008
hi all,
I was wondering if it is possible in SSAS 2005 that a calculated member is based off of an (integer) dimension attribute and another (integer) measure (let's say a multiplication operation) ?
If there a trick on doing so? other than stuffing the (integer) dimension attribute back in the fact table, as an measure?
thx much,
Cos
View 6 Replies
View Related
Oct 8, 2007
Hi all
Probably not the right forum - pointers would be appreciated - but I'll give it a try anyway:
I'm in the process of designing a relational database to be used in a BI scenario - ie. dimension and fact tables. The data will eventually be used to feed cubes in Analysis services, however end users will probably be allowed to run reports aginst views of the relational database.
I'm currently looking at the employee dimensions and my first try would designate AGE as a SCD Type 2 attribute. As a result every employee gets at least one new record every year as AGE increases. Given that BIRTHDATE is specified should I drop AGE from the tables and recreate it as a computed attribute in database views and/or cubes?
Regards, Steen
View 7 Replies
View Related
Aug 8, 2007
I am in the process of develping a MSRS report using an MSAS 2005 OLAP cube as my data source. In the MSRS Query Builder, I am using an MDX query which successfully executes in Management Studio. Something like the following:
SELECT
NON EMPTY { [Measures].[Fact Count] }
ON COLUMNS,
NON EMPTY{ ( [Dim Attribute].[Hierarchy Not Visible].ALLMEMBERS) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME
ON ROWS
FROM [MyCube]
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
The twist is that the AttributeHierarchyVisible property of the [Dim Attribute].[Hierarchy Not Visible] is set to False.
As mentioned previously, the query successfully executes in Management Studio. However when it is executed in the MSRS Query Builder, the following error message is displayed:
The query cannot be prepared: The query must have at least one axis. The first axis of the query should not have multiple hierarchies, nor should it reference any dimension other than the Measures dimension..
Parameter name: mdx (MDXQueryGenerator)
Is there a way to successfully query dimension attributes whose hierarchies are not visible?
Thanks.
View 2 Replies
View Related
Sep 29, 2006
I have a Slowly changing dimension that I am using to
populate a dimension table. My problem is this when I run the package and
any of the fields are marked as Historical Attributes it will add an additional
row regardless of the fact that the incoming data and the data in the warehouse
match exactly.
I've tried several things to fix this problem but so far none of them have
worked. Some of the things I have tried that havent worked are to match
all the data types (which I have to do anyways) I've tried trimming the
strings, I've also tried adding just one column
I am using a data conversion to convert them from varchar (the source datatype)
to nvarchar(the warehouse datatype)
I'm at a dead end here and don't know where to go any help would be greatly appreciated.
Thanks
View 5 Replies
View Related
Aug 28, 2015
How to move attribute from one dimension to another in a cube?
View 2 Replies
View Related
Aug 13, 2015
I have date hierarchy with year - qtr- month - date. from the below query, if i have a date or month or year on rows, i want to derive the top member in the hierarchy that is year. I f i have date on rows,
[Date].[Calendar Hierarchy].[Date].&[20150106],I should get [Date].[Calendar Hierarchy].[year].&[2015].
How to find the parent?
with member [dt7] as Drillupmember([Date].[Calendar Hierarchy].currentmember,
[Date].[Calendar Hierarchy].[Calendar Year])
select {[dt7]} on 0,
([Date].[Calendar Hierarchy].[Month].&[201501]) on 1
from Cube
View 5 Replies
View Related
Aug 13, 2015
For example, I have a Date dimension with attributes like Current Day and Current Month. If I run the following, I get exactly what I expect: a list of the days in the current month.
select
NULL on 0,
[Case - Date - PSPT Entry].[Year - Quarter - Month].[Date] on 1
from [Customer Support]
where
[Case - Date - PSPT Entry].[Current Month].&[True]
When I run the following, I'm getting a list of the days in the current month *plus the first couple days of the next month*. with
set [Days of Interest]
as
filter([Case - Date - PSPT Entry].[Year - Quarter - Month].[Date], [Case - Date - PSPT Entry].[Current Month].&[True])
select
NULL on 0,
[Days of Interest] on 1
from [Customer Support]
View 2 Replies
View Related
Jul 31, 2015
I have a Tabular model with a situation where I want to have three alternate attributehierachies in one dimension.
Dimension FruitAndVegetables (with 4 columns: Id, Name, Fruit and Vegetable)
Id Name Fruit Vegetable
1 Apple Apple
2 Onion Onion
3 Banana Banana
4 etc
Now I would like to put Vegetable on rows in a report without getting a blank row (with the sales of all Fruits)..I would like to supress all those Fruit records without adding a separate filter to the report, just let the user pick this Attribute should do the move.
View 2 Replies
View Related
Sep 17, 2015
I've been working with SSAS for a good few years now but I keep bumping into this problem - my users are trying to build a measure that is based on a calculated attribute and finding it difficult to work out how to write the MDX to do so. Intuitively, they thought a Calculated Member would work, but I don't think a Calculated Member is quite the same thing from my understanding.
So, here's the scenario.
We have a Product Dimension. We have a Measure that is the Number of days the Product took to make, e.g. 5 days. We also have a Product Count measure that counts the number of Products.
The user would like to write a calculated measure that works out the number of products that took <5 days, 5-10 days, 10-15 days etc.It would be easy to write a set of calculated measures for each of these bandings, but the user wants effectively a single dynamic attribute to use in the calculation in order to automatically distribute these values across the columns in their pivot table.
Is this even possible? I was thinking I could build an attribute on the Product Dimension in the ETL to do this quite easily, but the user wants to be able to change the bandings on the fly by changing the MDX for the attribute, rather than go back to the developer every time.
View 4 Replies
View Related
Jul 8, 2014
1) Errors in the OLAP storage engine: A duplicate attribute key has been found when processing:
Table: 'dbo_Dim_x0020_Document_x0020_Type',Column: 'Item_x0020_No_', Value: '1100'. The attribute is 'Item No'.
How can I resolve this on package level.
2) I am also not able to see all the fields of a fact table when creating cube, where I can se all fields in dataview.
View 6 Replies
View Related
Apr 16, 2015
I have a parent Child attribute in my dimension. I am currently displaying the correct ID value as the business wants. So now they can see the rollup of the ID(intOrgNodeID ) values.They would also like to see the same rollup of the Name (vcharOrgNodeName) for this ID.However they do not want it concatenated. They want to be able to see them separate.You cannot create two parent child attibutes in one dimension so not sure if there is some simple trick to make this work? It seems like there should be some simple trick for this.
My dimension table looks something like this
intdimOrgNodeID int Key (surreget key)
intOrgNodeID int (Actual ID)
intDimParentOrgNodeID
vcharOrgNodeName
In the Propertys I have set this below.
KeyColumns = tbldimOrgNode.intDimParentOrgNodeID
NameColumn = tbldimOrgNode.intOrgNodeID
View 8 Replies
View Related
Sep 2, 2015
getting Correct Measure based on Member Present in Other Attribute .
I am working on SSAS 2012 and have cube build and ready ..
I have Two Measure in Cube
[MEASURES].[Actual] and [MEASURES].[Target] and I need to create One more Calculate Measure
I have dimension DimProduct
I want to Display [MEASURES].[Actual] if Color "Purple" is present for PRODUCT1 Else Display [MEASURES].[Target].
MDX to create Calculate Measure for this logic?
View 4 Replies
View Related
Aug 17, 2015
Our SSAS integration didn't initially use attribute relationships.Now that our system has been running for a few years and we have bigger databases, we think we need to add them to improve performance. So we're in the process of adding them but we found out that, when attribute relationships are added, the full unique name of our members all go from something like:
[DIM].[HIERARCHY].[LEVEL].&[GRANDPARENT].&[PARENT].&[MEMBER]
to something like:
[DIM].[HIERARCHY].[LEVEL].&[MEMBER]
It looks nice and SSAS will accept the longer names fine but it will return the short ones in response to 'discovery' requests and in the XMLA response of MDX queries. This is causing problems in our low level XMLA-based modules that assume the long names in and out. is there any clean way to use attribute relationships and still have SSAS generate the long member names. We fiddled with the various documented dim/attribute properties but to no avail. It also appears that some switches are obsolete.
View 6 Replies
View Related
Jun 12, 2015
I 've read that there is a workaround for this issue by customizing errors at processing time but I am not glad to have to ignore errors, also the cube process is scheduled so ignore errors is not a choice at least a good one.
This is part of my cube where the error is thrown.
DimTime
PK (int)MyMonth (int, Example = 201501, 201502, 201503, etc.) Another Columns
FactBudget
PK (int)Month (int, Example = 201501, 201502, 201503, etc.)
I set the relation between DimTime and FactBudget doing DimTime MyMonth as Primary Key and FactBudget Month as Foreign Key.
The cube built without problem, when processing the errror: The attribute key cannot be found when processingwas thrown.
It was thrown due to FactBudget has some Month values (201510, 201511, 201512 in example) which DimTime don't, so the integrity is broken.
My actual question: is there a way or pattern to redesign this DWH to correctly deploy and process?
View 4 Replies
View Related
Jun 10, 2015
I am unable to see my DSV when I try to edit my dimension. I have added some new fields in my dimension table and now want to use them in my cube dimension.
View 5 Replies
View Related
Dec 24, 2002
Trying to create a time dimension off of a large table. When I go with the default "start year at Jan. 1", everything goes fine. When I switch that to July 1, however, (drat those fiscal years, anyway), the construction of the dimension times out. Any suggestions?
View 5 Replies
View Related
Apr 16, 2004
I have a database with millions of users with email addresses. I want to create an email domain dimension that groups domains into all the big email domains (hotmail, aol, yahoo) and an "other" consisting of all the other domains. I can create a table with entries for the big domains, and get the grouping working but anything that is not a big domain will get thrown out rather than put into an "other" category.
Any idea how to get such an "other" category?
View 1 Replies
View Related
Aug 19, 2015
I am trying to define the security based on Current Member.
Can i put following statement in the DimensionData - Allowed Members Set
EXISTS([Dim M].[Emp No].MEMBERS, [Security EMP].[Role].CurrentMember, "Uvw Security Emp ")
So that the list of EMP Nos that are visible changes when a different Role is selected (Filtered).
If not then is there any other way of achieving the same? What I want is that the list of EMP No that are visible should change when the user filters it using "Role" attribute in the "Uvw Security Emp" dimension.
If I add the Role attribute in the Dim M Dimension I think it will unnecessarily calculate aggregations, etc.
View 2 Replies
View Related
Nov 18, 2015
I have a measure group product price, the measures are
1. Product Id
2. Price
3. Date
I have mapped the product id and date with product and date dimensions.I need to get the latest price of the product.For example:
Prod1, 100, 1/1/2015
Prod1, 300, 2/1/2015
Prod1, 250, 3/1/2015
Prod1, 150, 10/1/2015
So, i need the latest price. The latest price is 150.I new to MDX query. MDX query to achieve this?
View 3 Replies
View Related
Jun 4, 2015
I am in a situation to slice a fact in two date dimension .. my <g class="gr_ gr_73 gr-alert gr_spell ContextualSpelling ins-del multiReplace" data-gr-id="73" id="73">sql</g> code is like this
select count(1) from fact_table where end_date >=(selecteddate on filter) and startdate <=end_date .
The common date dimension is Start date. and the filter will be only on <g class="gr_ gr_168 gr-alert gr_gramm Grammar only-ins doubleReplace replaceWithoutSep" data-gr-id="168" id="168">end</g> date.
Below is the code so far
<g class="gr_ gr_228 gr-alert gr_tiny gr_spell ContextualSpelling multiReplace" data-gr-id="228" id="228">i</g> did, but <g class="gr_ gr_229 gr-alert gr_tiny gr_spell ContextualSpelling
multiReplace" data-gr-id="229" id="229">i</g> am not finding how to filter the start date <=end_date
with member [Measures].[X] as
Sum(
{[EndDate].[YQMWD].currentmember:NULL},
([Measures].[Count]))
select [Measures].[X] on 0 ,
[EndDate].[YQMWD].year.members on 1
from Cube
What is the trick I can put so that I can filter those data where start date <=selected end date ....
View 3 Replies
View Related
Jun 15, 2015
If I have a dimension with 3 records like this:
BrokerDimId BrokerNm
1 Broker1
2 Broker2
3 Broker3
And I have a fact table that has 2 rows that join back to the first 2 dimension rows like this:
BrokerDimId Amt
1 $100
2 $200
I want to create the mdx so that I get all of the dimension rows, even if there is no record in the fact table for it and just default the amount to 0, like this
BrokerDimId Amt
1 $100
2 $200
3 $0
Is this possible using MDX?
View 2 Replies
View Related
Sep 1, 2015
I am getting the dropdown of the dimension folder twice, as i took printshot from client tool. In SSMS/bids also its showing this error. How to resolve it.
View 9 Replies
View Related