Analysis :: Ragged Hierarchy - Unary And Custom Rollup Calculations
Aug 13, 2015
Any working example of what a ragged hierarchy should look like for the unary and custom rollup calcs to work?
I have a parent-child hierarchy that works as expected but can't manage to get the same with a flattened ragged hierarchy. Parents disappear if any of the children aren't in the fact table (even though the children are set to '~' and the parent has its own custom rollup calc).
Do I need to replicate the unary and measure formula all the way to the end in the same way i do the member name/value (so i can set ignore if same as parent)? Setting unary to null seems to work when the key doesnt exist in the fact table but the default behaviour for null is '+' so i end up getting wrong results if the key does exist!
Repro:
In words
I have an EAV style fact table. The measure name is defined in a 'dim measure' table. Some measures exist in the fact, some are manufactured using Unary ops or custom rollup formulas.
Here's a diagram of the hierarchy
I want to recreate the functionality as a flattened hierarchy (the number of levels is fixed), but can't seem to do it... Here's what I've gotten for the same hierarchy created using the two different approaches
Below are queries to recreate the tables from adventureworksdw2014. The parent child hierarchy is set up the standard way... measureparentkey is parent. set name, unary and formula as expected. Set NonLeafDataHidden for the parent attribute. I've tried various combinations for the ragged hierarchy but none work 100% of the time. I want to have a user defined hierarchy for the performance benefits.
--Fact view
CREATE View dbo.FactSales
AS
select fis.ProductKey
, fis.OrderDateKey
, 1 AS MeasureKey -- salesAmount
, fis.SalesAmount AS MeasureValue
[Code] .....
View 3 Replies
ADVERTISEMENT
Jul 15, 2015
I have a disconnected utility dimension with the following data and a waterfall->subwaterfall hierarchy. I have ignore if same as parent set on sub water fall. The unary operator is assigned to the relevant level
WaterFall WaterFallUnary SubWaterFall SubWaterFallUnary
Opening ~ Opening ~
Price ~ Price ~
Total Composition ~ Composition L1 +
Total Composition ~ Composition L2 +
Total Composition ~ Composition L3 +
Total Composition ~ Composition L4 +
Total Composition ~ Composition L5 +
Closing ~ Closing ~
I'm using MDX to set values to the members
SCOPE(Measures.Waterfall,[Dim Waterfall].[Water Fall].&[Price]);
THIS=Measures.LowestPrice;
END SCOPE;
SCOPE(Measures.Waterfall,[Dim Waterfall].[Sub Water Fall].&[Composition L1]);
THIS=Measures.[Composition L1];
END SCOPE;
[Code] ....
But when i run a simple select query
SELECT
{[Measures].[Waterfall]} ON COLUMNS,
[Dim Waterfall].[Water Fall].[Water Fall] ON ROWS
FROM [GPA]
I only get a value for price. Total Composition is NULL. If I change my query to look at the subwaterfall level then I see values for composition L1->L5, so I know there are values there I was expecting the unary operator to aggregate my composition measures into Total Composition.
I should point out that every measure that's being assigned to my utility dim is calculated with in excess of a dozen or so steps and intermediate calcs, is this causing some kind of solve order issue?
I know that as a workaround i could probably do something like
SCOPE(Measures.Waterfall,[Dim Waterfall].[Water Fall].&[Total Composition]);Â Â Â Â
   THIS=SUM([Dim Waterfall].[Hierarchy].[Water Fall].&[Total Composition].Children,Measures.Waterfall);   Â
END SCOPE;
But that defeats the purpose of the unary operators
This is sql server 2014 multidimensional
View 5 Replies
View Related
Aug 29, 2007
Hello all, I´m a beginner on AS2005 (but I know pretty well AS2000), I migrated a cube from AS2000 to AS2005 but in this cube I have a Custom Rollup Formula on two levels of my Time dimension (month and week), an example of the week level formula is the next:
iif( [Time].CurrentMember.Name = [Time].CurrentMember.NextMember.Name,
null,
iif( [Time].CurrentMember.Name = [Time].CurrentMember.PrevMember.Name,
Sum({[Time].CurrentMember.Children,[Time].CurrentMember.PrevMember.Children}),
Sum([Time].CurrentMember.Children)
)
)
<<this formula overrides the week aggregations>>
and I really need this but I cannot find on AS2005 where to do the same thing, someone can tell me where can I define Custom Rollup Formulas and how?.
Thanks in advance!
View 10 Replies
View Related
Jun 22, 2005
after I've created a new column in a table with the "Create a new column" with custom members. How do I actually remove this newly created column without recreating the dimension ?
Thank you
Tom
View 1 Replies
View Related
Jul 27, 2007
I'm loading a fact table that has several geographic attributes - some are at the state level, some are at the county level, and then some are drilled farther in that that. I understand the basic concept of the dimension with the ragged hierarchy, but unsure of how to load to the fact table using lookups based on these geographic units. For example, if my geographic dimension contains 200 records for the state of Wyoming, basically a record for each fine-grain place (i.e. city/town), then how do I go about doing a county lookup. Wyoming only has 23 counties, but because of the repetitive nature of the dimension attributes that are not at the finest grain, I'll get more records in the lookup than I need. This activity repeats of course while I move up the geographic scale to state, then country. How do I configure/fill my dimension to handle these differing scales of data?
View 2 Replies
View Related
May 21, 2015
how can use this mdx script in the calculation part of a cube, will i simply dump it in the script form by starting with the 'create member current cube.
[measures].[test]'
selectÂ
[measures].[abc] on 0,
[xyz].[xyz].(&0):[xyz].[xyz].(&60) on 1
from
(
select
(tail([month].[month].[month].members,6))on 0
from
[cube])
View 3 Replies
View Related
Aug 3, 2010
I am looking a way to use a tail funcion to achieve something like this
Â
If you see the picture i want obtain in one row the total amount of the month over a selected range. If I select months between 1 and 12, i want the values only for the month 12, if a select months between 1 and 10 I want only de value for October and so on.
Â
I tried this simple mdx query:Â
Select
Tail([Id Fecha Orden Pago].[Mes].allmembers,1) on
Rows
,
{[Measures].[Total Gastos Orden Pago]} on
Columns
From
[CUB_DGM_TestEnamiDW] WHERE
[DIM Programa Fomento].[Nombre Programa Fomento].&[RECONOCIMIENTO DE RESERVAS]
View 7 Replies
View Related
Jul 7, 2015
I have built an analysis cube and I am wondering how I can now somehow add in some kind of forecastinbg to it?
I have a time dimension in years, quarts, months, days.
Is there a way I can show forecasting calculations for future dates?
View 2 Replies
View Related
Jun 29, 2015
I am currently creating calculations for weekly and fortnightly ranges by day.
Is it better to use LastPeriods or Tail? For example, the last 14 days could be:
LastPeriods(14,Â
StrToMember
(
"[Date].[Year Week Day].[Date].&[" + FORMAT(Now(),"yyyy-MM-ddT00:00:00")
+"]"
) Â Â
))
Tail(
Filter(
{[Date].[Year Week Day].[Day]},Â
([Date].[Year Week Day].CURRENTMEMBER, [Measures].[Test Measure]) > 0
), 14
)
What is the advantages or disadvantages?
View 3 Replies
View Related
Jul 27, 2015
Is there a way - through a DMV or other query - that I can retrieve the collation for a hierarchy using code?I know that I can find out the server, cube, and hierarchy collation using SSMS. But I'm looking to do this in code, in order to compare collations between two cubes' dimensions, and compare member values.
View 7 Replies
View Related
Jun 19, 2015
I have a fact table that captures the captures oldest date between a Task date and todays date per Person (so there is only fact per person) like this - a measure is created from the Task Days
PersonID, Dateduekey, Task Days
130Â Â Â Â Â Â Â Â Â 20130809Â Â Â Â 679
I have a person dimension which has a hierarchy of Department_Name->Team_Name->Person I have created some MDX that gives the MAX Task Day for the hierarchy but when you Person attribute of the hierarchy the code runs really slow.with set a as nonempty(([v Dim Fee Earners].[People Structure].[Person],[Dim Calendar].[Primary Date].[All]),[Measures].[Days KPI]) member measures.a as max(existing(a),[Measures].[Days KPI])
How can I get this running for more efficiently when [v Dim Fee Earners].[People Structure].[Person] is selected? To be fair the true measure [Days KPI] is already calculated at person level so if there is way to use the [Days KPI] when [v Dim Fee Earners].[People Structure].[Person] is selected that would be good
View 6 Replies
View Related
Jul 28, 2015
I am trying to compute average of Sales amount for 10 days and I am having an issue when using LAG function. Since weekends fall in between working days my LAG (10)Â function is also including weekends and hence I am not able to get the correct average.
For ex: D1 - 10 , D2 - 20, D3 - 30, D4 - 50, D5 - 10, D6 - W, D7 - W, D8-10, D9 - 20, D10 -30, D11 - 10, D12 - 40, D13 - W, D14 - W
I am using a sample script
SUM([Time].[Hierarchy].CurrentMEMBER : Time.[Hierarchy].Currentmember.Lag(9), [Measures].[Sales Amount])/10
When I use this and When my current member is D12 Then I am getting the value as 200/10 = 20 (from D12 to D3).
However ideally it should be 230/10Â =23 (from D12 to D1) and lag should exclude D6 and D7 as it is a weekend.
I also have a working day flag in my time dimensions which says 0 for non working days and 1 for working days.
View 2 Replies
View Related
Jul 31, 2015
I have a Tabular model with a situation where I want to have three alternate attributehierachies in one dimension.
Dimension FruitAndVegetables (with 4 columns: Id, Name, Fruit and Vegetable)
Id Name    Fruit     Vegetable
1 Apple     Apple  Â
2 Onion                  Onion
3 Banana  Banana
4 etc
Now I would like to put Vegetable on rows in a report without getting a blank row (with the sales of all Fruits)..I would like to supress all those Fruit records without adding a separate filter to the report, just let the user pick this Attribute should do the move.
View 2 Replies
View Related
Oct 7, 2015
I want to display Month and year from same time hierarchy in two separate columns.My hierarchy is as below:
Ship Date > Ship Date Hierarchy
Ship Date year
Ship Date Quarter
Ship Date month
The display I am looking for is as below
Ship Date year Ship Date Month
measures
2015 Jan
200
2015 Feb
300
I am using Tail function as I need only the last 13 months, below is my query:
with set [Month] as
{
tail([SHIP DATE].[Ship Date Hierarchy].[SHIP CAL MTH].members, 13)
}
select
{[Measures].[TAG BUID Distinct Count]} on 0,
{[Month]* [SHIP DATE].[Ship Date Hierarchy].[SHIP CAL YEAR]} on 1
from
[GSDR_P4]
This gives me error that The Ship Date Hierarchy hierarchy is used more than once in the Crossjoin function.
View 2 Replies
View Related
Apr 17, 2015
I am working to get 'NULL' as a string instead of blank in below shown Hierarchy
Level1: ASIA
Level2:Â (BLANK)
Level3: Indonesia
Malaysia
NOTE: In Level2  '(BLANK)' means it is  actually blank.
I tried changing 'UnknownMemberName' to 'NULL' at the Dimension, but this did not work.Â
View 3 Replies
View Related
Sep 24, 2015
I am having a requirement as below. I am having a Emp_Dim dimension table which is having a Manager_Key which is dependent on again on the Emp_Key. Based on the designation I have to create a Hierarchy. I have to create a Hierarchy with 10 levels according to the Designation.
While extracting data I am giving a particular Area manager id in Emp_Key I should get the accumulated data (His and the employees working under him as well). So it's like my MDX query should be like this if I am giving any emp_key then I need all the business done by under him.
My doubt is how I can establish the relations between the different levels in my Hierarchy. I am pretty new to SSAS.
View 3 Replies
View Related
Jun 9, 2015
I am using a "Client" dimension that includes a "Holding - Client" hierarchy. I have to make sure, that only the appropriate roles may access appropriate members from this dimension, but I only have the information which role may access which ClientID - I do not have the information which HoldingID should be accessible. Also, "Client" is used as the key column of the dimension with "ClientID" and "HoldingID" as key columns. The hierarchy is strict, no client may belong to multiple holdings.
I cannot seem to find the right MDX for the allowed member set. My MDX expression would need to look like this:
[Client].[Holding - Client].[Client].&[*]&[123]
In this example I want to give access for client &123, no matter the holding, so &1&123 and &2&123 would be allowed.
Is this doable?
View 4 Replies
View Related
Jun 8, 2015
I have a time dimension which has Date, Week, Month and Year. However, the hierarchy will have only Week, Month and Year. It works great for any Sales measure with AggregateFunction as SUM.
I have created a new measure with AggregateFunction = LastNonEmpty. Also in the backend, I have pushed all the inventory data to last date in every month as inventory is always looked on a monthly basis not on a weekly basis. This measure shows correct data for every last week of the month in the hierarchy. However, Months and Years are displayed as zeros.
what I am doing wrong.
View 8 Replies
View Related
Apr 8, 2015
Include children and exclude children in a single hierarchy in parent child dimension in mdx
*12-parent
 **20-parent
 - 9-parent
      --250-child1
      --210-child2
    --240-child3
aggregation of 12-parent only
aggregation of 20-parent only
aggregation of 9 with children
View 3 Replies
View Related
Jul 9, 2007
Some DB Field ID
X
2007
2008
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
A
X-A
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
B
X- A -B
1
500
10
20
0
0
0
0
0
0
0
20
50
0
100
400
25
10
10
0
0
5
0
25
15
10
10
20
130
270
2
750
10
10
10
20
20
10
10
20
10
10
10
10
150
600
20
20
20
20
30
30
10
10
10
30
30
30
260
340
3
600
All,
I am trying to achieve something as above. Basically, the Months subtotals are represented by A and B. Then (X-A) and (X-A-B) are also the subtotals at the same group level as A and B but don't simply display the total for respective years 2007 and 2008, instead those are remaning totals from X. In order to calculate the remaining totals however, one need to consider the subtotal in previous group. For example, for 2007 its X-A, but for 2008 its X-A-B. I would like to know if this can be achieved using Matrix control. If so, what would be the steps?
Thanks.
View 5 Replies
View Related
Aug 11, 2015
I am working on a model where I have a sales fact table. Each fact record has four different customer fields (ship- to, sold-to, payer, and bill-to customer). I have one customer dimension table that joins to the sales fact table four times (once for each of the customer fields above). When viewing the data in Excel, I would like to have four hierarchies (ship -to, sold-to, payer, and bill-to customer) within Customer.Â
Is there a way to build hierarchies within my Customer dimension based on the same Customer table? What I want is to view the data in Excel and see the Customer dimension. Within Customer, I want four hierarchies.Â
View 2 Replies
View Related
Nov 21, 2008
Uknown Member is set to "Uknown" in the cube . This cannot be changed because it needs to be visible in other applications. However, in my particular MDX I want to create a custom set that excludes this member.
WITHSET setNoUnknowns as EXCLUDE( [Dim].[Hierarchy].CHILDREN, { [Dim].[Hierarchy].UNKNOWNMEMBER } )SELECT{[Measure].[MeasureName]} on COLUMNS,setNoUnknowns on ROWSFROM [Cube]
With the above MDX, I still get a return for member "Unknown". I've confirmed that there isn't an explicit member name of "Unknown".Excluding [Dim].[Hierarchy].[Unknown] does not work either.
View 5 Replies
View Related
Jul 23, 2015
I have a requirement where I need to show the maximum value in grand totals but for the dimension members the same measure has to sum.
For ex: lets say I have a measure called Test and this is a base measure. The aggregation type set  to this is SUM.
For this same measure the grand totals should not show the sum instead it should show the maximum value of the dimension members which is being analyzed across.
View 4 Replies
View Related
Jun 26, 2006
i have a problem with deriving sql statement which involve a unary relationship for one of the table.
i have tables with the following attributes:
studetn table: student_email (PK), student name
section table: section_no, section_semester (composite primary key)
the above has a a M:M relationship. (in my sql database, i will have a student_section table in btw).
There is also another evaluation table which records the student_email of student evaluating another student (this will be shown as team_member email)
evaluation table: evaluation_id (PK), student_email, teammember_email, studentinput
I use the following sql to get the student name for the student who is evaluating and the students being evaluated:
select form_id, temp_tb.student_email, temp_tb.student_name, teammember_email, student.student_name as teammember_name, studentinput
from (select form_id, student.student_email, student.student_name, teammember_email, studentinput
from student inner join form_evaluation
on evaluation.student_email=student.student_email) as temp_tb
inner join student
on temp_tb.teammember_email=student.student_email
After that, i need to join to the student_section table. However because a student can be in different sections, so the student section table will have 2 entries with the same studentemail, therefore the above query (when inner join with student_section table)actually retrieve the same result twice.
student section:
AAA@edu.com | section1 | 2005/2006
BBB@edu.com | section1 | 2005/2006
AAA@edu.com | section 2 | 2005/2006
final query results: evlauation table
formid| studentemail | teammemberemail | studentinput
11111| AAA@edu.com | BBB@edu.com | "very good"
11111| AAA@edu.com | BBB@edu.com | "very good"
11111| BBB @edu.com | AAA@edu.com | "ok"
11111| BBB @edu.com | AAA@edu.com | "ok"
how do i resolve the problem?
View 5 Replies
View Related
Apr 17, 2008
I have a table of products, and many products have the same name only they are different sizes. I want to only select a particular size like 20 oz, but if it does not exist in that size I want to select the next appropriate size (and which case if it does not exist i wish to select the next appropriate size and so on ..
Does any one know how I can accomplish this and would be willing to help me out by posting some code, some direction ??
View 15 Replies
View Related
Jun 4, 2015
Problem setting is a geography dimension with multiple user defined hierarchies in SSAS 2008.Â
Ex.:Â
Hierarchy 1 (political territory): level 6 --> level 5 --> level 4 --> level 3 (state) --> level 2 --> level 1
Hierarchy 2 (sales territory): level 4 --> level 3 --> level 2 (sales region) --> level 1
...
Hierarchy 9
The relationship between state and sales region is n:1, i.e. one state belongs to exactly one sales region, and one sales region can consists of one or multiple states.  Unfortunatly I can't define this attribute relationsship in the dimension because it would lead to a diamond-shaped relationsship without a user-defined-hierarchy to back it up. So far that isn't much of a problem, user don't drill down from sales region to state. But now I want to define a calculated member that multiplies a measure from the main measure group with another measure from a weighting factor measure group at the state level and above. The granularity attribute of the geography dimension in the dimension usage tab of the weighting factor measuregroup is the state.Â
So far what I've got is:
CREATE MEMBER Currentcube.Measures.[weighted measure state and above] AS NULL;
SCOPE (Measures.[weighted measure state and above],
Descendants(geography.[political territory].[all member],3,SELF_AND_BEFORE),
Descendants(geography.[salesterritory].[all member],2,SELF_AND_BEFORE),
... Descendants(geography.[hierarchy 9].[all member],1,SELF_AND_BEFORE)); this = sum(existing(geography.[political territory].state.members), measures.[main measure group measure] * measures.[weighting measure group measure]);END SCOPE;
This works from a functional point of view, but is rather slow when querying any other hierarchy than the political territory hierarchy, because SSAS first goes down from the state level to the key attribute of the geography dimension, and then aggregates from there to the sales region.In other words, I want SSAS to resolve the relationsship (which state belongs to which sales region) through the dimension, and not through the fact, and apply the calculation afterwards. Like some kind of currency conversion, but only from a certain level upwards.
View 5 Replies
View Related
Dec 25, 2007
Hi,
I am exporting a table to a fixed width flat file using "Ragged Right" format. Though i specify carriage return for the last column, the text file is not taking it up.
I am doing the following for connection
cmFlatFile.properties("Format").SetValue(cmFlatFile,"RaggedRight")
cmFlatFile.properties("RowDelimiter").SetValue(cmFlatFile,vbCrLf)
and while adding the column i am setting up the width as follows
vColumns = flatFileDestination.InputCollection(0).GetVirutalInput().VirtualInputColumnCollection
For cols = 0 to vColumns.Count -1
Dim col As IDTSConnectionManagerFlatFileColumn90 = ff.Columns.Add()
if cols = vColumns.Count - 1 Then
col.ColumnDelimiter = vbCrLf
end if
cols.ColumnType = "FixedWidth"
cols.Columnwidth = 20
......
Next cols
Still the rows are exported next to each other just like when we use FixedWidth.
View 4 Replies
View Related
Feb 20, 2007
I have a table with a field that has a numeric data type (15,2) and length of 9. The problem is that it won't display the actual negative sign for any values less than 0 when running a query. Any ideas? I've used Query Analyzer as well as Access.
Thanks.
View 8 Replies
View Related
Aug 27, 2007
For some reason, when I try to use the Flat File Source and set the record type to Ragged Right it does not seem to recognize 'short' records. It seems to be confused by the CRLF set delimiters and not recognize these in 'some' records. The input does not seem consistent. What am I missing?
View 1 Replies
View Related
Aug 9, 2007
I have tab delimited text files which may have optional fields (meaning they can be not present at all) to the right of the required fields that I care about. It would appear that using a Flat File Connection with Delimited Format (tab) set will choke if it is initially configured with a file that has something like:
data data data
and it then encounters
data data data optionaldata
It chokes. I know this could be parsed line by line, but that seems silly. It seems like there should be a way to ignore columns beyond a certain point (e.g. Format "Delimited Ragged Right").
Is there some way to do this with a directly with a flat file connection?
Thanks,
--Andrew
View 1 Replies
View Related
Oct 30, 2007
Iam trying to load a RR Flat File(Ragged Right) into SQL Server DB Destination.
The file feeds the data into two tables and the logic looks like this..
If Position 30 = ''
Record Set goes into Table 1
Else
Record Set goes into Table 2
I have no clue where to start with my limited SSIS Exposure.. Any Ideas as to what i shud be starting with (Transformations)??
Thanks in Advance.
View 1 Replies
View Related
Sep 14, 2007
how do I make the output columns padded with extra space ? I intentionally set my output width larger than the input width, but the generated file is still jamming all the columns next to each other
View 2 Replies
View Related
May 19, 2015
I writing the data from sql table to flat file destination. I want to insert the record count in the first line of the destination file.
Record count must preceed 00.EX . Writing 4500 records from database should show 004500 in the first line of flat file.
I have an execute task to store the count in a variable now.
View 0 Replies
View Related