ssas 2005 calculation between two measure group - ssas

I am new to SSAS. E.g.I have a sales measure group, with one measure: amount (aggregate function: sum) . Also another measure group sales 1 with one measure: transactions (aggregate function:DistinctCount). now I need to calculate average amount per transaction, so it should be amount/transactions. How can I do that? Is it calculated member in cube designer - calculation tab?

Just create a calculated measure. To do this, open the "Calculations" tab of the cube editor. Then click on the calculator button in the tool bar, which opens the "Calculated Member" editor. Fill the fields, at least name and expression, possibly format string, associated measure group, and/or display folder as well, and deploy the cube. The expression should be something like
[Measures].[Amount] / [Measures].[Transactions]
You can drag and drop items from the bottom left into the expression if you are unsure about the naming conventions. The slash (for division) of the expression you will have to enter manually.

Related

SSAS - No of Working Days as Named Calculation

I am new to SSAS. I have a requirement, I need to calculate no of working days between user selected date range (either in Excel or SSRS or PowerBI). I found the MDX query, I need assistance with create a named calculation with MDX expression.
Date Dimension (Filtered):
MDX:
WITH MEMBER Measures.WorkingDays AS
COUNT
(
exists( EXISTING {[Dim Date].[Date].[Date].members}
, [Dim Date].[Is Weekday].&[1] )
)
Select {Measures.WorkingDays} on 0 ,
[Dim Date].[Month].[Month] on 1
from [Project Cube]
where ([Dim Date].[Date].&[2018-01-01T00:00:00]:[Dim Date].[Date].&[2018-04-25T00:00:00])
I need to add this named column on Fact table as measurement. I am having trouble with the below items:
Creating named query with MDX expression mentioned.
Adding a [Number of Working Days] as measure in Fact table.
Please correct me, If I am doing it in wrong way. My requirement is I need a [NoOfWorkingDays] as measure in fact table, so that I can use SSAS aggregate to use it as input on other measure, such as ([utilization%] = ([ActualDaysWorked] / [NoofWorkingDays]).
Note that, I can do analysis with the given MDX, but I need to deploy it with precalculated values in cube, so that end user can directly use the cube.
Kindly let me know, if more details required, Thank you.
Welcome to SSAS and MDX. Now to the answer.
I need to add this named column on Fact table as measurement. I am
having trouble with the below items:
Creating named query with MDX expression mentioned. Adding a [Number
of Working Days] as measure in Fact table.
You dont need to add it to the Fact table at all. Open your SSAS project, in your object explorer double click your cube. Now on the top left hand you will see a CALCULATIONS tab. In the CALCULATION tab, Click new calculated member, the icon has a calculator on it.
Please correct me, If I am doing it in wrong way. My requirement is I
need a [NoOfWorkingDays] as measure in fact table, so that I can use
SSAS aggregate to use it as input on other measure, such as
([utilization%] = ([ActualDaysWorked] / [NoofWorkingDays]).
If I remember correctly, the calculated members will not be added into the Aggregations, however the underlying measures would be. Secondly if you are wondering that you can use your calculated Measure in another calculated measure. The answer is yes you can use it in another calculated measure. So this is totally possible
> ([utilization%] = ([ActualDaysWorked] / [NoofWorkingDays])
where [utilization%] and [NoofWorkingDays] are calculated measures.

SSAS hide measure for certain dimension

How to hide measure or a scope if user choose certain dimension or go to certain dimension hierarchy level?
Thanks.
Try something like this in your MDX script:
FREEZE([Measures].[My Measure], [Product].[Subcategory].[All]);
([Measures].[My Measure], [Product].[Product].Members, [Product].[Subcategory].[Subcategory].Members) = null;
Freeze ensures the next statement won't null out the category level totals. The next statement bulls out that measure for the whole product dimension up to the subcategory totals but not above.
Note this is fine for nulling out meaningless numbers but isn't a security feature. A savvy user could do a drillthrough command to get the product level numbers. Or a savvy user could connect in a special way and clear the whole MDX script for his session so he sees the detailed product data.
For a more secure approach:
If you can null out product data for all measures then setup role based security. In dimension data security only grant access to member Subcategory.All only but uncheck visual totals on the advanced tab so that the subcategory grand total is the real total.
Or setup a second slimmed down Product dimension that only has the top levels not the detailed product levels. Then only tie that dimension to this measure group.
Or create a second measure group that does a group by in SQL and joins to the Product dimension only at the Category level. Thus there is no detailed data only rollups. Then with security control whether a used sees the detailed measures or the summary measures.
On measure properties you can set set visible property to false for the measure you want to hide. Another option is to use perspective and choose again what you want to hide or not.

SSAS Dimension attribute as Calculated Measure

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.

SSAS 2005 put measures in the same folder in excel

I created a SSAS 2005 cube and connect to it from Excel 2007. I have a measure group sales. The key of the table is receipt no, line no. Now I create a new measure transactions, which is count distinct of receipt no. SSAS 2005 automatically assign the new measure in a separate measure group. The problem is in Excel, sales related measures are now in two measure groups (the sales and newly created one for the transactions). I find it a bit of awkward to go to these two folders to drag these measures since they are requested together a lot.
Is there a way to put these measures in same folder? I know there is a folder property for each measure in BIDS, but that will just create a new folder under existing folder for the measure group. Thanks.
One workaround would be to make your distinct count measure invisible, and to define a calculated measure in the calculation script that is just replicating this invisible measure, and setting its ASSOCIATED_MEASURE_GROUP to the name of the main measure group. The ASSOCIATED_MEASURE_GROUP property of a calculated measure is just use for display purposes, as far as I am aware.

ssas 2008 how to remove total for non hierarchy 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.