Aggregating the result of calculated member in SSAS - ssas

Good afternoon everyone, I have some problem with the result of aggregating a calculated member in a cube. Namely: I have two groups of measures Sales and Product, where I have two measures the sales qty and the product weight, I need to calculate the qty of products sold in kg.
I created a calculated member where I multiplied these two measures.
I understand that it would be more correct to implement this immediately in the fact table, but there are some difficulties with this.
I found many examples using the SCOPE operator, but there are also problems with this, as in DSV, I use not tables, but named queries, and I can’t create a named calculation on the fact table in, can there be any other solutions to the problem?
An example picture is presented below.
Thank you in advance.
my picture link is in a comment

Related

ssas tabular - measure design

question about measures in ssas tabular. Is it better to have the physical measure in the fact table as a column and then do a simple sum measure? e.g
Imagine the scenario I have a measure called Income in the fact table, but the user wants to see ProductA income, Product B income as individual measures (not using income measure with product dimension, which yes gives the same result)
Or is it better to do a dax calculation with a sum and filter based on the product dim. e.g. Product B Income:= CALCULATE(SUM('fact'[Income]);VALUES('Product Type dim');('Product Type dim'[Product Tye] ="ProductB"))
I have tried both methods and both return the same result... just want to know what would be best practice here. (fact table around 300million rows)
The fewer the measures the more performant your report will be in the end. I would recommend, in this situation, just sticking to a simple sum() measure and applying it each product. This would be the most efficient approach, doing a calculation on 300 million rows whilst filtering and invoking Values will definitely slow you down.
DC07 How are end users viewing your model? Are they using it in PowerPivot (excel) or PowerBI? I would suggest performing those calculations in either the visualization element (PowerBI) in PowerPivot as a method of displaying the calculation.

SSAS Tabular Date Filter Across Role Playing Date Dimensions

Using an accumulating snapshot fact, I multiple role-playing date dimensions in my Tabular Cube.
Users would like to be able to see when ANY of the date events occurred during a given period (as opposed to ALL of the date events which is quite natural in the tool).
This is essentially an OR statement.
I have tried adding another instance of the date dimension and then joining all of the role-playing dimensions to it (shown below), but am not having much success.
Not fully shown, but indicated are two fact tables related to the dimensions as well.
How can I essentially apply an OR condition to multiple dimensions from a pivot table?
The problem at hand is to retrieve the number of orders in a given month that are Received, Returned, or Invoiced. As in:
Time Period = January 2016
Received Count = 20
Returned Count = 16
Invoiced Count = 32
Thus, a fact record with ReceivedDateSID = 20160101 and ReturnedDateSID =20160115 and InvoicedDateSID = 20160130 should count once in each measure.
One straightforward approach that will perform great but require 3x more memory is to:
Have one DimDate
Have FactReceipt, FactReturn, FactInvoice. FactReceipt joins to DimDate on ReceiptDateKey. FactReturn joins to DimDate on ReturnedDateKey. FactInvoice joins to DimDate on InvoiceDateKey.
You can even put a where clause on the SQL view defining those fact tables. For example you only need the 1% of orders which are returned in FactReturn.
I personally prefer this approach to tons of complex DAX. Anytime a measure (like Returned Count) only makes sense with one role-playing date dimension I consider this approach.
You may also consider hiding all but one of those fact tables and putting all the calculated measures inside the one main fact table. That may reduce confusion for your users. Though drillthrough wouldn't work right then.

Linking date dimension from two different cubes

I have two cubes
Computer Engineering
Environmental Science.
Both cubes have a same Date dimension.
I have two scorecards, each for Computer Engineering and Environmental Science as shown in following figure. I would like to have a result as shown in the figure.
I have a drop down filter which uses Date dimension from Computer Engineering cube. This filter works perfectly for filtering KPIs of Computer Engineering Scorecard since Date dimension and measures are from same cube. But it is not able to filter KPIs from Environmental Science cube because the Date dimension in filter and measures in KPIs are from two different cubes.
I have tried following ideas.
LinkMember - LinkMember MDX function can get equivalent member from different dimension but within the same cube. It is limited to only one cube.
LookupCube - By using a LookupCube MDX function on first cube, I am able to get the measures of second cube on it. But these measures don't pivot over Date dimension from first cube.
Linked Objects - I added measures from second cube to the first cube as linked objects, but it did not create dimension usage relationship with Date dimension from first cube. Thus unviable.
I don't want to create a gigantic single cube.
Please help me suggest a solution or work around. Thanks in advance.
I'm wondering why Linked Objects didn't help. Let's create everything step by step.
Here is structures of two cubes, which I used:
Virtual cube creation:
The major disadvantage of this method:
You can't just add a measure to one of cubes, which are used in a Virtual cube.
You have to re-link the cube to avoid this error.
Hope this information helps.

What should I look at to diagnose an SSAS dimension definition error?

I'm pretty new to SSAS and am having problems presenting aggregations based on two different dates. Here is a quick rundown:
fact table:
sale measure
order date
ship date
time dimension
pk_date
fiscal year aggregation columns
I have defined in the data source view two different relationships from the fact table to the time dimension table, one joining pk_date to order date, and the other pk_date to ship date.
I've defined two different dimensions, ship_hier and order_hier, which use the two different relations.
SSAS doesn't seem to want to display data based on ship date. Both of the dimensions aggregta the data on order_date, even though the ship dimension is clearly defined to use the ship date rlationship.
At this point I have no idea where to even look. I'm sure it's something elemental. What should I look at to figure this out.
I think that problem might be because of you have added date fields for measures with some aggregation function probably SUM. You shouldn't select date fields for measures of the cube or check that there is no aggregation function for them.

Help needed on calculated measures

Patron Revenue Cube:
In one of the calculated measures “Acutal Gross Profit”, there are four measures used as
“[Measures].[Acutal Win]-[Measures].[Operator Pay]-[Measures].[Redeeming Dollars]-[Measures].[Redeeming Comp]”
The first two measures belong to vw_fact_patronrevenue view and the other two belong to vw_fact_patronredemption view.
Those two views do not have any foreign key relation to each other. They are related through dimension views.
To verify the calculated measure, I need to get the
column_names for the select statement (which I have),
table/view (i also have them)
joining column_names (which I don’t have, and how do I figure out which columns do I need for not-directly-related tables)
There are however some columns which are common to both tables
I would suggest that you don't need to write a single SQL statement to test your calculated measure. What you should do is to test each of the 4 raw measures, either independantly or in their measure groups.
When you know the 4 raw measures are correct you can then test your calculated measure "inside" the cube by displaying it alongside the 4 raw measures and checking that you have the arithmetic right.