Create Global Cube with measurements from multiple cubes - ssas

I have 2 cubes each with their own measurements. Some measurements from one cube are linked to to the second. For some reason, the query won't run if I use said linked measurements, but it will run it I only include measurements from the cube I'm selecting from. Now, from what I've read it doesn't look possible but I'd thought I'd check SO to be 100% sure and figure out a work around.
So, is there a way to select measurements from multiple cubes?
Cube Structure:
CUB1
Measures
FCT CUB1
Measure1
Measure2
Dimensions
Dim1
Dim2
CUB2
Measures
FCT CUB1 // linked measurements
Measure1
Measure2
FCT CUB2
Measure3
Measure4
Measure5
Dimensions
Dim1
Dim2
I have created a MDX query based on this section of MSDN: http://msdn.microsoft.com/en-us/library/ms145581.aspx
Query to create global cube on desktop:
CREATE GLOBAL CUBE [LocalTest]
STORAGE 'C:\LocalCube.cub'
FROM [CUB2]
(
MEASURE [FCT CUB2].[Measure1], // does not work with this
MEASURE [FCT CUB2].[Measure3], // here on is fine
DIMENSION [FCT CUB2].[Dim1],
DIMENSION [FCT CUB2].[Dim2]
)

I've never used the GLOBAL CUBE command so cannot comment on that. There is another way to refer to a measure in another cube, using the LOOKUPCUBE function. It can be a performance hit though. The only way to know is to test it. You can learn about the LOOKUPCUBE function here: http://msdn.microsoft.com/en-us/library/ms144720.aspx

Related

Is there any ways to dynamic cumulative measure in MDX?

All of the measure that I want to cumulative has the same formula. So, is there any way to use the thing like function or any thing in calculate measure to resolve this issue?
There are two ways to achieve your aim:
1- the first solution is based on using the business intelligence wizard to add time intelligence to your solution.
The time intelligence enhancement is a cube enhancement that adds time calculations (or time views) to a selected hierarchy. This enhancement supports the following categories of calculations:
List item
Period to date.
Period over period growth.
Moving averages.
Parallel period comparisons.
The wizard will let you chose the calculations and measures you want to apply.
Visit : https://learn.microsoft.com/en-us/analysis-services/multidimensional-models/define-time-intelligence-calculations-using-the-business-intelligence-wizard
Visit : http://www.ssas-info.com/analysis-services-articles/62-design/2465-ssas-time-intelligence-wizard
2- Use a dimension table to calculate your calculations, this solution is more complicated, but very powerful and one of the best practices.
The first step is to create a new physical dimension, with real
members for each of the calculations we're going to need. We don't
actually need to create a table in our data warehouse for this
purpose, we can do this with an SQL view like this
CREATE VIEW DateTool AS SELECT ID_Calc = 1, Calc = 'Real Value' UNION ALL SELECT ID_Calc = 2, Calc = 'Year To Date'
Next, we need to add this view to our DSV and create a dimension based
on it. The dimension must have one hierarchy and this hierarchy must
have its IsAggregatable property set to False. The DefaultMember
property of this hierarchy should then be set to the Real Value
member. Giving this dimension a name can be quite difficult, as it
should be something that helps the users understand what it does –
here we've called it Date Tool. It needs no relationship to any
measure group at all to work.
Our next task is to overwrite the value returned by each member so
that they return the calculations we want. We can do this using a
simple SCOPE statement in the MDX Script of the cube:
this code let you create the YEAR-TO-DATE aggregation for all your measures.
SCOPE ([Date Tool].[Calculation].[Year To Date]); THIS = AGGREGATE ( YTD ([Date Order].[Calendar].CurrentMember), [Date Tool].[Calculation].[Real Value]); END SCOPE;
Visit:https://subscription.packtpub.com/book/big_data_and_business_intelligence/9781849689908/6/ch06lvl1sec35/calculation-dimensions

Differences between cube measures and mdx measures

is there a difference between a native cube measure (for example Measure1) and this mdx measure :
Measure2=[Measures].[Measure1] ?
Because when I use these measures together I dont get any results, and when I use them one by one I get what I want.
So the Cube Measures are present at the time of cube processing where the "MDX measures"(correct name is calculations) are determined at the query time. You should try to use the Cube measures where ever possible.
Secondly they can be easily used together.

SSAS OLAP Cube - Sum measure only works when keys are present

(This is a mock of my actual setup to help me figure out the problem.)
I have one fact table and one dimension table, linked by an id field.
My goal is to make a measure that sums up all "thing_count" (integer) values in my cube.
If the user splits by nothing, it should show the total "thing_count" for all records in the fact table. If it's split by "category_name" from the dimension, it should show the total "thing_count" for each category.
I tried to achieve this by creating a SUM measure in my cube:
It works, but not in the way I intend it to
It always shows (null) unless I drag in the "id" field from the dimension.
Measure only:
Measure and category:
Measure, category, and id:
How can I make the measure show the value without keys needing to be present?
Edit:
For GregGalloway's request (I've edited the names so the screenshots are easier to follow):
One common explanation for this behavior (no aggregation) is that you have inadvertently commented out the CALCULATE; statement in your MDX script in the cube. Please check that statement is still present.

How the aggregation and calculated members work as combined to produce output in SSAS Cube

I am creating a POC on the SSAS. Ultimate goal is to be able to perform any kind of the calculation either ad hoc calculation or pre calculated with good performance. Existing solutions is based on the SQL server but due to the performance issues with huge data facing issues.
I need some insight upon how the Cube works to give faster outputs. I have created date dimensions with hierarchy Year-> Semester-> Quarter -> Month -> Week -> Date. Several other dimensions are linked with the date dimension. My cube has almost 10 to 15 dimension which have several role playing dimensions.There are almost two to three dates in every fact table.
How the Cube aggregates the data based on the dimensions linked to the facts?
Does it internally creates all the combination of the dimension values and saves the fact aggregate data internally?
Here i have attached an MDX script which hase YTD,MTD,QTD Calculated Measures.[Measures].[Value] measure has to be added based on the function applied on the date dimension. Does SSAS internally sum up the [Measures].[Value] for various hierarchy of the date/Other dimension/s? What exactly SSAS does to provide the final value fast?
Our system has large number of the fields whose calculation depends on the value selected by the end user to the number has to be calculated at run time by aggregating some other measures. Does SSAS is fast to provide the Calcualted Member output by using the internally aggregated values generated during the cube processing?
With Member [Measures].[YTDValue] as ([Measures].[Value],
OpeningPeriod([Rundate].[Calendar].[Date],[Rundate].[Calendar].CurrentMember.Parent.Parent.Parent.Parent.Parent))
Member [Measures].[QTDValue]
as ([Measures].[Value],OpeningPeriod([Rundate].[Calendar].[Date],[Rundate].[Calendar].CurrentMember.Parent.Parent.Parent))
Member [Measures].[MTDValue]
as ([Measures].[Value],OpeningPeriod([Rundate].[Calendar].[Date],[Rundate].[Calendar].CurrentMember.Parent.Parent))
SELECT
{
[Measures].[YTDValue],
[Measures].[QTDValue],
[Measures].[MTDValue],
} on 0,
{
[Rundate].[Calendar].[Date].Members
} ON 1
FROM
(
select
{
[Rundate].[Calendar].[Date].&[2015-01-09T00:00:00]
} on 0
from [Cube_Sample]
)

Can you create an SSAS Tabular measure with filter constraints?

I am trying to get my head around how to design the SSAS tabular model for a scenario where I have an attribute on a dimension that will modify an otherwise straight-forward measure on a related fact table.
The fact table is currently at 155 million rows. The dimension has 6200 rows. The measure we need sums a unit volume fact, then multiplies that sum by a factor that belongs to the dimension. The context used for this measure has some constraints, then: the aggregation can never include multiple rows from the related dimension. It doesn't make any business sense to do so.
I started with this, which I know is wrong: =SUM([Unit Volume])*Products[Foo Factor], and of course the designer complains because the related attribute has many values without a specific context.
My work-around for now is to create a calculated column that brings the factor into the fact table: =RELATED(Products[Foo Factor]), and then I can create a measure that looks like this: =SUM([Unit Volume])*AVERAGE([Foo Factor]).
I don't like the idea of putting calculated columns on that fact table. It's huge and it only going to get bigger. I also don't like that there doesn't appear to be a way to put constraints on the context for a given measure so I can ensure the we don't roll up volume across multiple products. Or is there?
It seems to me that ours is not an unusual scenario, but I'm too new to DAX to know how to model it correctly. If I were in my familiar SQL world, I would use a windowing function like this:
select sum([Unit Volume]) over (partition by <context goes here>) as [Unit Volume Total]
Can I create something like this in a measure with DAX?
UPDATE
It seems like this should work, but the designer still barks:
=CALCULATE(SUM('My Facts'[Unit Volume])*Products[Foo Factor],FILTER(Products,Products[Product Code]="0"))
My thought was that the [Product Code]="0" filter would be replaced by the current context and since [Product Code] is defined as the key on the related table, SSAS would know my intent. Alas, it doesn't.
I think I may have it. Seems like I may not be able to get away from using an AVERAGE aggregation on the foo factor, but the HASONEVALUE function does enforce the constraint I want.
This should work:
=
IF (
HASONEVALUE ( Products[Product Code] ),
SUM ( 'My Facts'[Unit Volume] ) * AVERAGE ( Products[Foo Factor] ),
SUM ( [Unit Volume] )
)
Please try this:
=CALCULATE((SUM(My Facts[Unit Volume])*Products[Foo Factor]),Products[Product Code]=0)
Also please confirm Product Code format.