Is there a way in a SSAS cube to exclude members in a dimension attribute by changing the dimension structure? I am wanting a solution that doesn't use perspectives.
Example:
California
- Los Angeles
- Sacremento
- San Francisco
Let's say in the above hierarchy I wanted to exclude Sacremento. Is there a way to exclude this members and others by changing the dimension structure, or is the only possibiltiy to use a perspective?
There are 3 possibilities:
Place a filter on the queries of the data source view of the UDM and remove any data you do not want to see in the cube.
Set security on your cube and deny access to the sacremento member of that dimension for a certain role.
Write specific MDX queries that exclude dimension members, e.g.
Except(
[States].Members,
[States].[Sacremento]
)
Related
We have a cube with many measures and one of the main dimensions is a 'site' dimension with about a dozen sites.
I've been asked to add a 'site' that is basically ALL the sites.
They don't want the actual hierarchy,
I tried defining the ALLMEMBER attribute but they don't want another hierarchy level, they want an actual attribute member at the same level. They want the whole displayed as another site next to the actual site values
Example:
Right now with the all member attribute I can show
All Sites - 140
+
New York 45
Chicago 60
Boston 35
But what they want is this:
New York 45
Chicago 60
Boston 35
All Sites 140
I'm not sure where to go from here in BIDS. It's not really a named dataset, nor a calculated measure. It's really a custom attribute member.
You can define a calculated Dimension member in your cube calculation script.
You'd need something like:
Create member Site.site.AllSiteCalc AS SUM(Site.site.children,Measures.currentmember)
Once you've processed the cube this should become available in ssms,excel or to use in a query
I am on an MDX adventure and I'm at a point where I need to ask some questions.
I have a very basic dimension named Car. The attributes which comprise Car are as follows-
-Manufacturer
-Make
-Color
-Year
My fact table contains a sales measure ([Measures].[Sales]). I would like to know , without explicitly defining a user hierarchy, how to sum the sales from
a specific group in this hierarchy
For example, I want to sum the sales of all red Trucks made in 2002. My attempt errors out-
sum([Cars].[Make].[Make].&[Truck]&[Red]&[2002], [Measures].[Sales])
How can I navigate the attribute hierarchy in this way? I will be browsing the cube in excel
Thanks
If you open an mdx query in SSMS and drag a member from one of your attribute hierarchies into the query pain you will see the full name.
You definitely cannot chain hierarchies like this ...].&[Truck]&[Red]&[2002]
Each full name will likely be similar to what MrHappyHead has detailed but usually the attribute name is repeated e.g. for Make:
[Cars].[Make].[Make].&[Truck]
MrHappyHead have wrapped it all in the Sum function but this is not required - just wrap the coordinates in braces and a tuple is then formed which will point to the required area of the cube:
(
[Cars].[Make].[Make].&[Truck],
[Cars].[Color].[Color].&[Red],
[Cars].[Year].[Year].&[2002],
[Measures].[sales]
)
note: square brackets are pretty standard in mdx.
Is it something like:
Sum(
Cars.make.&[truck],
Cars.color.&[red],
Cars.year.[2002],
Measures.sales
)
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.
How to hide measure or a scope if user choose certain dimension or go to certain dimension hierarchy level?
Thanks.
Try something like this in your MDX script:
FREEZE([Measures].[My Measure], [Product].[Subcategory].[All]);
([Measures].[My Measure], [Product].[Product].Members, [Product].[Subcategory].[Subcategory].Members) = null;
Freeze ensures the next statement won't null out the category level totals. The next statement bulls out that measure for the whole product dimension up to the subcategory totals but not above.
Note this is fine for nulling out meaningless numbers but isn't a security feature. A savvy user could do a drillthrough command to get the product level numbers. Or a savvy user could connect in a special way and clear the whole MDX script for his session so he sees the detailed product data.
For a more secure approach:
If you can null out product data for all measures then setup role based security. In dimension data security only grant access to member Subcategory.All only but uncheck visual totals on the advanced tab so that the subcategory grand total is the real total.
Or setup a second slimmed down Product dimension that only has the top levels not the detailed product levels. Then only tie that dimension to this measure group.
Or create a second measure group that does a group by in SQL and joins to the Product dimension only at the Category level. Thus there is no detailed data only rollups. Then with security control whether a used sees the detailed measures or the summary measures.
On measure properties you can set set visible property to false for the measure you want to hide. Another option is to use perspective and choose again what you want to hide or not.
I have dimension with hierarchy A - B and a time dimension.
I have made 3 different filters from that dimension in Performancepoint 2010, to use as cascading filters.
Cascading works fine, but sometimes dimension members are valid depending on the time dimension and cascading filters will give many "empty" members.
Ie. Jan 2010 only B1,B2 and B3 show measures, others members (B4,B5..) show empty.
How i can connect time dimension to cascading filters so it will only show the valid members at that current time?
I got it using NonEmptyCrossjoin - MDX function.
This function returns a set that contains the cross product of one or more sets, excluding empty tuples and tuples without associated fact table data.