Add Dimension Attributes Using MDX script - ssas

Hello I want to know if is possible to modify a cube dimension in order to Add a New attribute through a MDX script. I can do it using the MS BIDS, but I need to add this attribute for a single customer.
Thanks.

MDX Script is for calculations performed in the cube and is not for cube dimensions. On the other hand, you can use XMLA script to create objects: http://technet.microsoft.com/en-us/library/ms187152.aspx.

Related

MDX - Dimension on rows and Measure and a Dimension on Columns

I am now adding to something I am writing and need to offer the user the ability to place dimensions and measures on either the rows or columns.
I am about to test an idea to make the MDX for the example in the picture but realised I should also ask any MDX experts too!
So how would one go about pulling off this sort of layout? I cannot view the MDX generated by this Excel (data redacted due to being on site somewhere, also why I cannot download addins for MDX generator etc)
I actually did manage to get the OLAP extension addin installed.
https://github.com/OlapPivotTableExtensions/OlapPivotTableExtensions/releases/tag/v0.8.4
This will help me add some stuff to my MDX generator and prove invaluable as you can see the MDX Excel generates.
SELECT NON EMPTY Hierarchize(AddCalculatedMembers({DrilldownLevel({[Ccy].[Ccy].[ALL].[AllMember]})})) DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON COLUMNS , NON EMPTY Hierarchize(AddCalculatedMembers({DrilldownLevel({[Book].[Book].[ALL].[AllMember]})})) DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME ON ROWS FROM [TraderCube] WHERE ([Date].[Date].[ALL].[AllMember].[2019-12-12],[Measures].[JTD.SUM]) CELL PROPERTIES VALUE

SSIS/SSAS How can I show Month.Year as time dimension?

I am building a database for some data to build a cube (SSAS) after. Until now everything is fine and works but I want to modify my time dimension. Since now I have a table with year, month and day and use it as dimension. But for my use it would be nice if the hierarchy is not just like (2016-->5-->20); instead I want to show month.year at the month level (in this example: 05.2016). I had no problems separating the date but I can`t find a solution to show this part or to combine the two columns in SSIS. Is there any possibility to do so or can I create this in SSAS while setting up the cube?
What I´ve found out is that with the cast and datepart command I can show the things I want in the SQL Server Manager but I am a newbie in MS SQL and don`t know how to save the calculations in a new column.
Add a MonthYear column to your dimension table and populate it with a derived column transformation in SSIS that concatenates the month and year columns.

SSAS Dimension not displaying values in rows in Cube Browser

I am new to SSAS. Have added a new dimension to cube and when i see under members it shows the value of that columns but under browser section when i drag and drop the dimension it does not display anything
We need more information on what steps you took to get where you're at.
Do you have a relationship between the dimension and measure group?
Did you process the dimension, the cube?
I believe what is happening is that you haven't included a measure in the cube browser so it returned only the report dates which have a value for the "default measure". If you go to the first tab of the cube designer and right click on the cube node above the measure groups list on the left and choose Properties you will see a DefaultMeasure property. You can set that property to choose the measure which is the "default measure" when a user doesn't specify a measure in their report.
However I would recommend just dragging a measure into the cube browser to explicitly tell it to show report dates that have a value in that measure.
I also prefer not setting the DefaultMeasure property and adding the following to the MDX script so that the default measure is always null. That forces users to explicitly add a measure to their pivot so it is clear what they want.
CREATE MEMBER CURRENTCUBE.[Measures].[NullCalc] as NULL
,VISIBLE=0;
ALTER CUBE CURRENTCUBE UPDATE DIMENSION Measures, DEFAULT_MEMBER=[Measures].[NullCalc];

How to refresh a cube in SSAS, after making change to database

I made change to database, only changed datatypes from int to money.. But I can't make it appear in my cube, it is still unchanged. But if I create new cube, it is OK. But I don't want to create new cubes every time I change something in database...
Some know how do refresh the cube? Thanks
You need to first refresh your Data Source View, then edit wherever you are using that column in cubes or dimensions.
if you right click on your project containing your cube and then select "Process", cube will be processed and the data in the cube will be updated with the data on database .

How to sum a calculated measure?

I have a fairly complex calculated measure that works perfectly for each row of data from a cube. However, I then need a sum of those values line by line. But the behavior of calculated measures seems to be in the subtotal and total lines in Excel, it's performing the calculation again instead of summing the previous rows. Is there a way to have a calculated measure that performs it's calculation on each row, but they does a traditional SUM in the total and subtotals?
Thanks in advance.
A calculated measures does not aggregate; it will be computed each time.
There is a solution, but that is really ugly:
You would have to use something like
SCOPE([dim1].[hier1].[All]);
[Measures].[MyCalculatedMeasure] = Sum([dim1].[hier1].[bottomlevel].Members, [Measures].[MyCalculatedMeasure]);
END SCOPE;
for all hierarchies of all dimensions, be it an attribute or user hierarchy, replacing dim1, hier1, bottomlevel as appropriate.
You need to immitate real measure behavior for calculated member. Make dummy real measure with Null value and then use Scope to define your formula on the granullarity level. For more detailed answer see here: http://blog.crossjoin.co.uk/2013/05/29/aggregating-the-result-of-an-mdx-calculation-using-scoped-assignments/
I found the easiest way to do this:
Create a new named calculation in the appropriate measure table in your DSV. (Right click, add new named calculation and set its expression to be CAST(NULL as [insert appropriate data type]).
Add the new named calculation as a measure in your cube.
In the calculations area of your cube switch to script view and add the following:
({[Measures].[The named calculation you created in step 1]},Leaves())=Your complex calculation;
This sets the definition at the leaf level and all the aggregations work perfectly.
Ref: http://sqlblog.com/blogs/mosha/archive/2005/02/13/performance-of-aggregating-data-from-lower-levels-in-mdx.aspx