We have a SSAS 2012 tabular model at our disposal which we are reporting on with Tableau.
Currently, we have a dimension [Material] with an attribute [Department].
What we're trying to do is create an MDX calculated member equivalent in DAX for implementing a custom grouping of the [Department] attribute.
For instance:
CREATE MEMBER [Material].[Department].[AB] AS
AGGREGATE({[Material].[Department].&[A], [Material].[Department].&[B]})
We tried to add a calculated member [AB] in hierarchy [Material].[Department] in Tableau with this MDX expression:
AGGREGATE({[Material].[Department].&[A], [Material].[Department].&[B]})
At design time, the expression validates but when we try using that member in our report we get an error stating that this kind of MDX calculated members are not supported in DAX.
Does anyone know of an equivalent or if and how we should get this MDX member to work?
Use SUMX.
I would imagine your DAX measure would look similar to:
=SUMX(FILTER('Material', 'Material'[Department]=OR("A","B")),[MaterialQuantity])
A Tabular model does not support the creation of calculated members in the model. The best you can do is to use a query-scoped calculated member by defining it in the MDX query.
E.g.
WITH MEMBER [Material].[Department].[All].[AB] AS
AGGREGATE({[Material].[Department].&[A], [Material].Department].&[B]})
SELECT ...
FROM ...
Related
I've created a simple cube calculation that sums two measures.I only want to sum, or to return data when both measures return a value.
When I use the calculation in an MDX query, it works as expected, however when I browse the cube via a pivot table I it display all results, and not what I need. It seems to me that I need to modify the cube calculation to get the same NONEMPTY behaviour as per the MDX query, but I just can't get the syntax correct, or know if this is indeed the correct approach. I'd be grateful for some pointers.
Sample of underlying data:
Cube calculation:
This MDX statement does exactly what I want it to:
The IIF function would be useful in this scenario
For e.g.,
CREATE MEMBER CURRENTCUBE.[Measures].[RevalCombined]
AS IIF([Measures].[Reval]=0, NULL, [Measures].[Reval]) + IIF([Measures].[dReval]=0, NULL, [Measures].[dReval])
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.
I am very new to SSAS Cubes, and do not know MDX.
I need help in creating a calculated member. The dimension attribute that I am using in the calculated member calculation, is renamed, and that is why the calculation is not working.
I have a dimension named "IN" in the cube, and I am trying to count the "CounterKey" in the measures group when the value of attribute "C 1" in the "IN" dimension is 1.
I used the calculation below and it worked fine.
([Measures].[CounterKey count],([Dim IN].[C 1 Top Box].&[1]))
I had to rename "C 1" to a more user friendly/descriptive name i.e. "Courtesy TB". After changing the name, I made the change in the calculated member as below as below
([Measures].[CounterKey count],([Dim IN].[Courtesy TB].&[1]))
but the calculation is not working any more, and I am just getting a null as a result.
Any help will be highly appreciated.
It seems this is the wrong renaming or something else. Try to drag'n'drop the member from your cube and insert into the formula. Will the following return the null?
[Dim IN].[C 1 Top Box].&[1].UniqueName
If null, it means the member doesn't exist any more within a cube. It's a naming issue.
I tried to implement Dynamic Dimension Security in SSAS 2012 Multidimensional Model. I have a little knowledge on this for I have already implemented row level security in SSAS Tabular using DAX.
What I did in Tabular is exactly the same as described in MSDN.
http://msdn.microsoft.com/en-in/library/hh479759.aspx
The DAX I used in tabular is:
**='Organization'[Project Id]=LOOKUPVALUE('Employee Security'[Project Id], 'Employee Security'[Login Id], USERNAME(), 'Employee Security'[Project Id], 'Organization'[Project Id])**
Organization - Dimension Table on which Dynamic filtering should be
happened (on the basis of Project Id).
Employee Security - Dimension Table with Login Id of users are stored
I need to implement the same functioning dynamic security in Multidimensional model too.
Can somebody help me with the MDX and steps that should be used here to achieve the same?
If you want any more clarifications on my requirement please do ask the same.
Thank You in Advance.
In multidimensional model you need to have a dimension which contains all user ids (which are joined to the project ids).
Then create a role and use StrToMember function to dynamically catch the users id and convert that into a member from the security dimension.
{StrToMember("Dim.Users.&[" + UserName() + "]")}
More about this topic can be read here: http://richardlees.blogspot.se/2010/10/ssas-dynamic-security.html
I'm connecting to a SSAS data source from Tableau, and I'm having the following problem:
When I tried to create a calculated field in tableau, it gave me the "Unknown function sum called" error. I was doing a calculation as simple as this:
sum([Test Score])/sum([Score Count])
When using an Excel connection, the sum function works just fine. Is this some limitation of working with SSAS from Tableau?
Thanks ahead for any help!
Understanding Functional Differences Between OLAP and Relational Data Source Connections
When connected to a cube, aggregation functions such as SUM(), AVG()
and similar are not available in the Tableau calculation editor [...]
the aggregations have already occurred in the cube, and cannot be
further aggregated. Note that you can also use Tableau Table
Calculations to perform post-OLAP aggregation operations on the
cell-level results from the cube.