ssas: different measure based on hierarchie - ssas

i have one Cube with historical "fixed" data and one month of data that still is in review and can be changed slightly. My customer wants to select the fixed data with one Time-Hierarchy and the fixed + new data with another. I can not get it to work, especially the Total sum. I tried scopes for the different hierarcies but with no success...
I managed to hide the new month element in one hierarchy and made different measures for historical and new data, but now i have to select different measures based on which hierarchy is selected.
i imagined it has to work like this:
scope([TIME].[History]);
Measures.Sales = Measures.Sales_History;
end scope;
scope([TIME].[History and new]);
Measures.Sales = Measures.Sales_History_and_new;
end scope;
With this code i get one Measure for both hierarchies but not the other...
Thanks for the help!

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

MDX IIF statement to calculate new member basing on measure and hierarchy leaves

I have a simple Data Cube for computing shared expenditures with one measure Amount and some dimensions and hierarchies but interesting one would be Relationship. It describes who bought something for whom. It's structure is:
Who
For whom
Relationship key
I am trying to code a calculation representing debt. For example if I bought something for sharing usage it would be half of 0.5 * Amount. On the other hand, if I bought something for myself it would be 0 * Amount.
As far I tried following calculation:
IIF(
[dimRelationship].[Relationship].currentMember = [dimRelationship].[Relationship].[RelatonshipID].&[MeShared],
[Measures].[Amount]*0.5,
[Measures].[Amount]*0)
It works good only at lowest RelationshipID level. When I roll-up browsered pivot-table it is acting according to else-expression. That is not really surprising because hierarchy's currentMember is not MeShared anymore. Another bad thing that total aggregation work neither - it would be most important as a general summary. Is there any suffix like .LeafMember or something like that which could help me perform this calculation?
Thank you in advance!
Best regards,
Max!
In you fact table add another column, in this column store the "Amount" multiplied by the relationshipID for that particular row. This will address you issue right out the box
Try SCOPE statement.
Firstly, create new calculation [Debt Calculation] as [Measures].[Amount]*0 /* as ELSE-scenario */
Then create a SCOPE:
SCOPE([Debt Calculation],[dimRelationship].[Relationship].[RelatonshipID].&[MeShared]);
THIS=[Measures].[Amount]*0.5;
END SCOPE;
If it's the lowest level of hierarchy and is a dimension key (which is used as a link to measure groups), it will re-calc higher levels of this dimension automatically. Please post a result here if not.

How to show dimension members for which there are no values in fact in SSAS Multi-Dimensional?

I have two tables in my Ticket Management Application, "ExpositionPeriods" and "OrganisedVisits".
ExpositionPeriods - Defines the periods for which tickets can be purchased.
OrganisedVisits - Stores the tickets purchased information.
In the example below, we have 5 periods available, and tickets have been purchased for 2 of the periods.
The customer wants a report which shows "Number of visitors against each available period". That means if, for any period which doesn't have a visitor, the report should show "0" for that period. Something like this.
So far so good. Since the production database is humongous (~500 GB), it is not advisable to report on this database directly. Things turn to be challenging when I create an OLAP cube out of this schema and try to achieve the same report functionality in the cube. It seems the cube actually performs an action similar to SQL INNER JOIN as opposed to a LEFT OUTER JOIN and hence I do not see those Periods for which there are no tickets sold.
Is this how SSAS actually behaves? Am I missing out any particular setting that will indicate the SSAS engine to process the cube in a different manner so as to include the missing periods as well? Please note, end customers don't have access to MDX/DAX scripts, they can only use the cube by drag-drop measure and dimensions like in Excel pivot table.
In your image the browser is carrying out a non empty on rows on the date dimension. If you want to show the dates with no visitors then select the option to show empty cells.
You can define such scope in "calculations" as
SCOPE
([Measures].[Visitors]);
THIS=IIF(ISEMPTY([Measures].[Visitors]),0,[Measures].[Visitors]);
END SCOPE;
So you have zeros instead of nulls and side effect. You or customer can't hide empty cells, cause now it's not empty enough.

Power Bi creating monthly measure from repeated monhts

I have an application database that is designed the following way: (I cannot change it)
I need to be able to create a cash flow that can tell me by month, Property and type what the amount of that month is. I figured I need in a measure in a table that has all the months I need, but I am not sure how to do it.
Any help would be greatly appreciated it!
Link to screenshot, it wont let me post it directly
Even with the screenshot, it is not entirely clear to me what is meant by repeated month. I am assuming that if repeat_count = 2 and amount = 100 then amount_wanted = 200.
I am also assuming that you already loaded the data into Power BI.
In that case you need to perform the following steps:
Create a calculated column holding the month. You can do so using the function month(date).
Create a calculated column as
amount_wanted = [repeat_count] * [amount]
Create a new measure:
new_measure = sum([amount_wanted])
Create a matrix visual with property and type in the rows, month in the columns and new_measure in the values.

How to show totals of a measure if the dimension is not part of the fact table in OBIEE

I hope someone has a clue how to solve this issue.
I have two fact tables one with revenue per company, year, catalogue_no and revenue and the other with company, year and customer_base.
I want to combine these measures in an analysis but the catalogue_no is not part of the customer_base table.
What I've achieved so far, by setting the right levels in BMM, is that I can put the catalogue_no in the filter criterias and get the result that all figures are shown correctly.
As soon as I place the dimension catalogue_no into the selected columns the customer_base is only blank.
See the picture for Explanation. Link
You have to put the content level for the non-conformed dimension to the "Grand Total" level