I have a sales fact table with two dates: order received and order shipped.
I have a time dimension table in the data source view.
I have defined two relationships between the time dimension table and the sales fact table, one on order received date and order shipped date.
In the Cube definition I have two dimensions defined: one for order date and one for shipping date.
I have time hierarchy defined for both dimensions (the fiscal calendar).
I can't figure out which relationship either of the dimensions are using. It would appear that they are both using the join to order received date. How do I tell SSAS to use the shipping date for one dimension and the order received date for the other.
Thanks, --sw
I would open the Cube source in Visual Studio / BIDS, then open the relevant Cube object and navigate to the Dimension Usage tab.
Then find the intersection of the Dimension (row) and Measure Group (column) and click the Build (...) button for that cell. That will show you which columns are involved and let you select the correct Measure Group column.
When you first add a Dimension to a Cube, SSAS defines these settings using the Data Source View relationships (if any exist).
Related
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.
I am having some issues trying to implement an average of a dimension attribute.
The basic structure is:
Booking Header Dimension
Fact Table (multiple rows per Booking Header
entry)
On the booking header dimension I have a numerical attribute called Booking Window, and I want to be able to create a calculated measure that averages this value.
We are using SQL Server 2012 standard edition.
Any help would be greatly appreciated.
The best approach would be to create a measure group from the dimension table (in BIDS, go to cube designer, tab "Cube Structure", right-click the cube object in the Measures list, and select "New Measure Group", select your dimension table). BIDS will generate some measures, and you can remove all but two: the one based on your numeric attribute (I will call it "YourSummedAttrib" to have a name to refer to below), and the count measure. The aggregate function for the measure "YourSummedAttrib" will probably be "sum", leave that as it is.
Then, create a calculated measure which divides "YourSummedAttrib" by the count measure, which gives the average. Finally, if you have tested everything, make the two measures "YourSummedAttrib" and the count measure invisible before you give the cube to the users, as they only need to see the average, which is the calculated measure.
You can try this which should give you the average of that attribute across all members.
WITH MEMBER [Measures].[Booking Window Value] AS
[Booking Header].[Booking Window].CURRENTMEMBER.MEMBER_VALUE
MEMBER [Measures].[Avg Booking Window Value] AS
AVG([Booking Header].[Booking Window].[Booking Window].MEMBERS,[Measures].[Booking Window Value])
SELECT
[Measures].[Avg Booking Window Value] ON COLUMNS
FROM
[YourCube]
Hope that helps and apologies for any confusion on my part.
Ash
I tried to use the same idea, but without success. The solution I found was create a view with the calculated average and include a new group of measures.
Is there a way to access system tables in a SSAS cube calcuation?
For example the following query can be executed on a SSAS cube to return a last processed date:
SELECT LAST_DATA_UPDATE FROM $System.MDSCHEMA_CUBES WHERE CUBE_NAME = 'Cube'
How would one access this information in a calculation?
Background: We were using ASSP before (a third party sproc) to get the last cube processed date. Recently, this sproc threw an exception on one of our cubes and caused SSAS to go down. Using the above line of MDX did not have this behavior. I would rather not have our cube depend on third party code so I am looking for a way to access LAST_DATA_UPDATE in a calc for a specific cube name.
I usually include a detached Dimension in my cubes e.g. ".Cube Information" which includes attributes like this. Other useful attributes could expose the currency of the data e.g. when did the last underlying ETL process complete, or the release/build of your cube.
I feed this "Cube Information" dimension from a SQL view which returns a single row with whatever data is needed - you could use your SELECT statement. It also needs to return a Key column with a fixed value e.g. 1.
By "detached" I mean the "Cube Information" dimension has no entries in the Cube Dimension Relationship tab.
In the cube Calculation script, I assign the DEFAULT_MEMBER property for that dimension to the fixed Key value from the SSAS view.
Any client tool can then access those Dimension attributes.
As you can see there is a Total added automatically. The Birth Date and Full Name are not hierarchy attributes. They are both from same dimension. I want to show birth date and full name. How to get rid of the Total?
One way to do this is to Compute a calculated member on your DSV. You can name it for example Birth-Name.
To do this
Open your Data Source View
Right click on the dimension name
New name calculation
Name: Birth-Name
expression: birthday+' '+fullname
Add the new field to your dimension
Preview the cube with the new calced member and money measure
In this way you can view your data and the total of all of them together
There are other ways to do this also, but this is the simplest I could think of. The total cannot be totally removed from the cube, as this is what it's real job is. To make aggregations of data.
I have an SSAS cube with time as one of the dimention.It contains hierarchy like year-quarter-month etc.When i drag and drop the this on SQL Server Managment Studio window(brows), it looks like data is repeating.For example,year is like 2002,2002,2003,2003,.. etc.If i expand first 2002 i can see 1st quarter under that.If i expand second 2002 i can see 2nd quarter etc..Can any one tell what is the reason? how can i change to single data?
First of all are you using your own Date Dimension table. If so, make sure you use the correct key for Date, Month, Quarter and Year. For example, normally the date dimension has YearMonth column used as the key for the Month attribute (eg 2012-04). If you don't have such a column you will need to pick a composite key for Month (Year and Month). Also, a good way to check is in the dimension designer in BIDS go the browser tab of the dimension and make sure the hierarchies are showing up fine.