Calculate prorata share with MDX - ssas

I have a SSAS cube that shows Investors and their investment value in funds. The fund value and prorata shares are in fact table. I've created a calculated measure that simply multiplies fund value * share. The problem comes in the Total line. The row marked as WRONG is what shows now. The row marked RIGHT is what I want to show.
Investor Fund Value Share Investor Value
Investor 1 100,000 0.4 40,000
Investor 1 200,000 0.3 60,000
Total 300,000 0.7 210,000 <== WRONG
Total 100,000 <== RIGHT

Max answer is the way to go if performance might be a problem (precalculation). It's possible to solve the prorarta using MDX Calculated members (performance might be an issue if your dimensions are big).
The issue to go further into this solution is I need a dimension where the 100'000 and the 200'000 Fund Values are difference (e.g. [Share] .). Can you describe your dimensions ?

I know this is a few months old, but I would use a scope statement to overwrite that cell with the correct calculation. Check this out: http://www.bidn.com/articles/mdx-and-dmx/94/mdx-scripting-with-scope-statement To view the article requires a login, but its free.

Simplest way: create new calculated field (write an expression) in DSV (in the corresponding fact table) of your olap DB. And after that use this field in the measure (aggregation type SUM).

Related

Power BI: Measure for Date difference depending on other columns

I hope everybody is doing fine! :)
I have a table like the one in my "Example" picture. Let's say it is data about certain products and a certain assembly status (i.e. column "Status"). In "Status Date" I can see the date on which the product has been in the specific status. I only added dates for ID 1 to make the table easier.
Table
What I am looking for is a measure in Power BI to calculate the difference (in days or month doesn't matter) between the dates. I don't want to use the number in the Status (e.g. 1 for Stat 1) to identify the order of the dates. To make it even harder, I may want to filter out Stat 2 for some reason. In that case I want the measure to automatically adapt and calculate the difference between Stat 3 and Stat 1.
I have the feeling that this is possible in a single formular using a measure which would be the optimal solution from my point of view.
I hope there's someone who can help me!
Thanks in advance.
Daniel

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.

SSAS measure value aggregate error

I have a Fact table with the following rows
When I process my cube I want results like this :
However when procession my cube I get the following results:
I have fee rate (hourly rate) as a measure but it is summing the values when LineID is the same (see value highlighted in red), even though the dates and start times are different.
How can I change my Hourlyrate measure to only display the unique value and not a summation? I have tried changing the AggregationFunction to None but this gives me null values.
You've done a poor job of explaining your requirements and your issue.
Anyway, I would try changing the AggregationFunction for your Coll Fee Rate measure to Max. That will show the highest underlying value.
Try changing AggregationFunction for "Fee Rate" measure to AverageOfChildren
for more details
https://msdn.microsoft.com/en-us/library/ms365396.aspx
I managed to solve this by creating a Dimension table containing the fee rates and then used to this determine the rate

Tableau - Adding dimensions together to show overall revenue

I am very new to Tableau (first day user) and have been a long time Excel user. I am trying to fully understand the power of Tableau to eventually move away from Excel.
I have a question concerning dimensions and creating a calculated field.
My table has multiple categories and sub-categories. My goal is to display the total revenue and average order value per chosen sub-category (this seems easy enough).
I want to then take those sub-categories and show a combined sum of revenue and average of the average order value. I am stuck on trying to also combine these sub-categories to show a blended view.
Furthermore, the 2 sub-categories are weighted very differently. The average order value of 1 has a much heavier weight than the other and will definitely affect the AOV when combined. How do you also assign a weight to this combined total?
Any help will be much appreciated. I know this may be a rather simple solution but I am new to the program and am having difficulty finding this answer.
Tableau screen:
or
img1 http://postimg.org/image/dq5wqgnyl/
Best,
CR
Put sub categories in the rows column.
Put sum revenue in the text pill in the marks section
In the analysis tab on the top select column grand totals.
I'm unable to see your images,i hope this answers a apart of your question.

display always the right MDX (sub)total in the client-application (eg Excel)

I can't figure it out! (CustomRollUpColumn??, or some custom made MDX calculated thing)
My problem: I have a dimension TypeOfRow who's function it is to display the ... well yes ... type of row. I'm working in the financial sector and, always, need to provide the ultimate result ==>> The Total Contribution. I read, amongst others, the article of Martin Mason ( http://martinmason.wordpress.com/2012/02/26/the-ssas-financial-cubepart-1ragged-hierarchies/ ) and designed the dimension as a "Naturalized Parent-Child Hierarchy".
The dimension, 5 levels, I designed for this solution is (simplyfied):
•+/+ Revenue (several types of)
•-/- Cost (several types of)
•= Total Contribution
A user requirement is that the "Total Contribution" always display the "Total Contribution" even if any the Revenue- or Cost types are filtered out.
My question: is this possible showing the total of a dimension without showing all the members (in Excel but I hope to configure this in SSAS 2008R2)?
many thanks in advance, - Leon