In the process of creating a new cube for my client, I encountered a problem I'm not sure hot to deal with.
I have a table that doesn't have a DateTime field; instead it has a varchar field which contains year and month in YYYYMM format. I need to create a relation to my Time dimension using that field; and proceed with creating Year-Quarter_Month hierarchy.
First thing I did was creating a new named calculation in Time table from the date field to match the YYYYMM format. Now, I understand that the relation can't be created because it would break the referential integrity.
My idea is to create a new Time table/dimension and delete all records except the first day of the month, create a YYYYMM named calculation and then I would be able to create a relation between my table and that new Time table. But, is this the right approach and what downsides I can expect?
Thank you!
You don't need a separate time dimension...when connecting the new fact table to the existing time dimension (in the dimension usage tab) you can set the YYYYMM attribute as the "granularity attribute"...SSAS will handle the rest :-)
Also, if the format is YYYYMM (ie. 201504 for april 2015) then you might consider making it an integer (instead of a varchar) to save some space in your fact table.
You can create a new calculated column in that table to add the first day of the month:
convert(date, YYYYMMfield*1000+01)
and then link it with your key in your time dimension.
This way, your YYYY-QQ-MM hierarchy levels work as intended, if the user is going deeper and wants to see monthly values on a daily basis, he will find all values for that month added to the first day.
Related
I'm creating a database that will be used for a web app for editing and preview of a Monthly Work Schedule. The principle behind this is to make a highly flexible layout that will provide building blocks for filtering, preview, and the making of templates.
The way it works:
There are 10 tables - each has a pretty simple data structure (ID, ShortName, Descr).
I want to make a table that will exclusively use data that already exists in those tables and save those combinations as new schedules.
So, you pre-make all the elements and then you put them together like Legos for final product/schedule.
Important - I want to enforce 7 tables- Center, Rank, Role, One, Two, Year, Month. Without all those selected (or if duplicate) you can't save/create a new schedule.
Now, I have two dilemmas here:
1. Should I create clustered indexes from those values like in the image
2. Should I make PK - and make it like serial number so that it's incremented using the data from those tables, e.g. Center(01) + Rank(02) + Role(12) + One(15) + Two(01) + Year(2019) + Month (07) = 0102121501201907
Also, another dilemma is Year/Month entry
I need JUST Year and JUST Month as Columns and values. Which way would be recommended here?
Can I make a Custom Data Type that will trim month and day from date to have just Year?
Should I define Year as int and make a defined table with Months (ID, Name)?
I can't go with a date because I need Year and Month as individual constraining parameters. I don't need Days - and removing day value from a date format through functions and user interface sounds like too much work for something that should be relatively simple. (performance-wise)
Also, making Year and Month as int and defining 12 Months - I'm afraid I'll lose some functionality just because I'm not familiar enough to use it.
This is my first work of this kind, and I feel like these decisions will heavily influence everything I do onward, so any advice whether from experience or from theory/book/site is highly appreciated.
I have a fact table of Delay by Date by Category (and many other Fields). I have another (target) table of DelayTarget by Month and Category.
I am currently associating the target table to the fact table on Month & Category but when there is no Delay for a given Category in a given Month, then the DelayTarget value does not display in my dashboard.
How do I associate the DelayTarget to all Months in my main dataset - even when there is no Delay to report? I think I want to create a Zero value for Delay when it is null but I don't know how to do this or if this is the best method.
You need to create MasterCalendar to fill gap in dates.
I can give you more detailed answer but the best would be to share you data model (ctrl +T) and some example data from tables (or even better just.qvw)
I am working on SQL Analysis service to provide ad hoc reporting in my application. I have created a time dimension to use in my cube. It has some predefined attributes. e.g. Month of year. It is having values like Month 1, Month 2, etc. while I want January for Month 1, February for Month 2, etc...
Can any one please suggest me some work around it??
As I am newbie to SSAS, Sorry if I am missing something very silly....
When you work with attributes in SSAS, there are two properties that affect the members of that attribute. The first property - which is set by default when you create the attribute - is KeyColumn. The column that you use here determines how many members are in the attribute because processing generates a SELECT DISTINCT statement based on this column. It's a good idea if you use an integer value here for better performance.
It sounds like perhaps you have a month number for your attribute here, which is good. Except that you want to display a month name. In that case, you set the NameColumn property with the column in your data source view that contains the month name. This produces the label that you see when you browse the dimension.
That said, it's usually not a good idea to have just a month number or month name because you probably want to create a hierarchy to roll up months by year and you won't be able to do that with just a month name. I wrote a blog post describing how to set up a date dimension that might help you: http://blog.datainspirations.com/2011/05/11/sqlu-ssas-week-dimension-design-101-2/
I have an SSAS cube with time as one of the dimention.It contains hierarchy like year-quarter-month etc.When i drag and drop the this on SQL Server Managment Studio window(brows), it looks like data is repeating.For example,year is like 2002,2002,2003,2003,.. etc.If i expand first 2002 i can see 1st quarter under that.If i expand second 2002 i can see 2nd quarter etc..Can any one tell what is the reason? how can i change to single data?
First of all are you using your own Date Dimension table. If so, make sure you use the correct key for Date, Month, Quarter and Year. For example, normally the date dimension has YearMonth column used as the key for the Month attribute (eg 2012-04). If you don't have such a column you will need to pick a composite key for Month (Year and Month). Also, a good way to check is in the dimension designer in BIDS go the browser tab of the dimension and make sure the hierarchies are showing up fine.
I have a Date Dimension called Dim_Date in my Data Warehouse. Now the issue is that my Date Dimension is only populated till 31st Dec 2011. My cube is built in SSAS. Is there any way I can populate my Date Dim for another 5 years? When I try to Process my Date Dimension from SSAS it does not populate any values. SO what is the best way to insert 5 years value into my date dimension?
Please Help
Cheers
Rushir
You could use an ETL tool (e.g. MS SSIS) for generating data for date dimension table. There is multiple examples for this, google is your friend.