I have a model developed in Tabular 2012. When I connect to the cube, I see FACT and DIMENSION tables listed.
I am not a developer - I am just asked to test the data load.
I just need to locate an example record from my source DB in FACT( Or Dimension ) table in the cube. I goggled it well, but could not find anything relevant as the the MDX queries I explored were always using some [Measure].blah blah to retrieve the data. Developer has defined just 1 measure in the DB. Is it possible to retrieve 1 row using MDX just like select 8 from table in SQL?
My problem is that even if I put one fact column on the columns axis and dimension key on row- axis, it just retrieves value 1.
I was under the impression that tabular did not have multi-demnsional cubes but has a "tabular model" as the underlying structure.
If you are using mdx and want several columns of data with just one measure then use CROSSJOIN:
SELECT
[Measures].[X] ON COLUMNS,
{CROSSJOIN (
[Dimension1].[someLevel].members
,[Dimension1].[someLevel].members
,[Dimension1].[someLevel].members
,[Dimension1].[someLevel].members) }
ON ROWS
FROM [cubeName]
Alternative syntax is:
SELECT
[Measures].[X] ON COLUMNS,
[Dimension1].[someLevel].members
*[Dimension2].[someLevel].members
*[Dimension3].[someLevel].members
*[Dimension4].[someLevel].members
ON ROWS
FROM [cubeName]
Related
Let us say we have a pivot table, that lists different departments of a school district. (each department being a unique row).
The number of hours of work put in by each department is the 2nd column of the pivot table.
I want to create a 3rd column that lists "dollar amount" spent by each department.
The issue being 'hourly rate' is not part of the cube that is used to generate the pivot table.. The excel spreadsheet has a manually written table that has 2 columns, (Dept, hourly rate).
I am wondering if it is possible to use the external table column 'hourly rate' using my olap mdx calculation?
I think you're asking if you can add some sort of Lookup functionality inside a custom measure to find values that are in the spreadsheet but not in the cube. I don't believe this is possible.
What is possible is the following.
Create a pivot table looking at your cube - this is mine against the AdvWrks cube:
Now, with the pivot table selected, hit this button:
You can now add a standard vlookup formula and drag down the right hand side:
Notice how the slicer of the pivot table has remained - so all formulas are still linked through to your OLAP cube.
The above is possibly some sort of route you might like to explore as a workaround ....or just add some more information into the cube!!
EDIT
This is not a very elegant solution but it is a way you can add your rate into the pivot:
In here select "MDX Calculated Measures..."
Then for my advWrks prototype I added this mdx:
case
when [Product].[Product Categories].CURRENTMEMBER IS [Product].[Product Categories].[Category].[Accessories] then 0.5
when [Product].[Product Categories].CURRENTMEMBER IS [Product].[Product Categories].[Category].[Bikes] then 2.5
when [Product].[Product Categories].CURRENTMEMBER IS [Product].[Product Categories].[Category].[Clothing] then 5
else 1
end
*[Measures].[Internet Sales Amount]
The above measure is called fooBar and can now be used in the pivot along with any other measure:
If there are 600 categories then my case statement will be pretty ugly - but it seems to be functioning as expected.
the previous answer gives your best options with pivot tables.
XLCubed (full disclosure, who i work for) is an add-in which handles this sort of limitation in olap connected Excel, & your scenario is detailed below. Basically a grid (pivot table equivalent) retrieves the SSAS data, and you can then add a user calculated column containing any standard Excel formula, in your case a vlookup:
http://blog.xlcubed.com/2016/06/calculated-fields-are-not-available-in-an-olap-based-pivot-table/
I am working on a Cognos Report Studio Version 10 where I have to convert SQL code into Data Items. I have all the Columns required in the package to drag as Data Items in the query but I am stuck where there's calculated fields. This is one of them
NET_ORIG_AMT derived from
(ORIG_ AMT) – (PARTICIPATION_ORIG_AMT)
ORIG_AMT was derived from a simple IF THEN ELSE function and could be easily created as a calculated data item.
But PARTICIPATION_ORIG_AMT is coming from this SQL code:
SELECT LEAD_ACCT,
PART_FLAG,
SUM (ORIG_AMT) AS PARTICIPATION_ORIG_AMT,
FROM TableName
GROUP BY LEAD_ACCT, PART_FLAG
HAVING PART_FLAG = 'Y'
How do I create a Data Item for PARTICIPATION_ORIG_AMT?
Pl note: I have LEAD_ACCT, PART_FLAG fields as calculated fields in the Query.
Can you help me understand how to write SUM (ORIG_AMT) AS PARTICIPATION_ORIG_AMT Group by LEAD_ACCT, PART_FLAG in Cognos Report Studio?
The equivalent in a Cognos expression would be:
total([ORIG_AMT] for [LEAD_ACCT],[PART_FLAG])
3 choices:
Create a separate query in Cognos specifically for PARTICIPATION_ORIG_AMT. Join this query to your primary query on the appropriate fields and bring this in.
Create a query subject for PARTICIPATION_ORIG_AMT within the model itself, and do the above in RS as described above. Preferred method if you are re-using this data item across reports.
Create a view in SQL which takes care of all of this special logic.
I have these 2 tables and I need to create a relationship between them so that I can import them into SSAS Tabular and run some analysis.
The first table has RollingQuarter(Moving Quarter) data. The second is a basic Date table with Date as PK.
Can anyone suggest ways to create a relationship with these?
Ill be using SQL Server 2012.
I could re-create a new date table also.
I think you may have a rough time finding a relationship with these tables.
Your top data table is derived data. It's an average over three months, reported monthly. The Quantity column applies to that window, not to a particular date like all of the stuff in the second table. So what would any relationship really mean?
If you have the primary data that were used to calculate your moving average, then use those instead. Then you can relate dates between the two tables.
But if your analysis is such that you don't need the primary data for the top table, then just pick the middle of each quarter (March 15th 2001 for the first record) and use that as your independent variable for your time series on the top. Then you can relate them by that.
I have build an MDX editor and now need a good default query which executes and already has two dimensions. I would like to place the measures on the first dimension (without knowing their names), and any other cube dimension on the second result dimension. Currently I have achived this:
select {[Measures].members} ON COLUMNS
from [mycubename]
But I don't know how to populate the second column... Any Ideas?
Something like
select {[Measures].members} ON COLUMNS,
{[Dimensions].[first].members} ON ROWS
from [mycubename]
which would work against any cube if the cube name is given in the from clause.
This works in Microsoft SSAS, so you may need to tweak the syntax for Mondrian:
SELECT Measures.DefaultMember ON COLUMNS,
Dimensions(1).Members ON ROWS
FROM [Cube]
Hi i m new to SSAS 2005/08. I want to create Cube from 1 table , Stored in OLTP Database. Table containg billions of records.
how to select dimension and Fact from this alone table.
Please help me.
A dimension derived from data in the fact table is known as a degenerate dimension:
http://en.wikipedia.org/wiki/Degenerate_dimension
Here's a link discussing how to model an data as both a dimension and fact attribute, if that's what you're wanting to do:
http://www.ralphkimball.com/html/07dt/KU97ModelingDataBothFactDimen.pdf