Showing posts with label holds. Show all posts
Showing posts with label holds. Show all posts

Wednesday, March 28, 2012

modeling a table with FK

I am having a problem when modeling a Foreign Key in an "Operations" table. This table holds all information on customers ′s applications and withdrawals.

Here is the structure:

CustomerID int, SourceID int, Value decimal (16,2), OperationDate datetime

Well the problem is that SourceID sometimes might be NULL depending on how the record was inserted. So its kind of cumbersome to define it as an FK, since it can be null...To get things worse, this SourceID might point to more than 1 table (depending on the CustomerType it will point to SourceA table or SourceB table)...

How should this be modeled?

What is sourceId? It sounds like you need to do a bit more normalization here and have a source table.

source
sourceId int
customerType
<other source bits>

Then your other tables like SourceA and SourceB reference this table, as well as the operations table:

create table operations
(
...I assume you have a key other than these columns,
customerId int
sourceId int null references source(sourceId)
)

Then the source will either be sourceA or sourceB depending on the customerType (assuming you are defining the source for a given customerType.) I am not sure that I am making sense, but this sounds like what I am getting from your post. If not, can you give your current table structures and a bit more about usage?

Monday, March 26, 2012

Mod operation

Hi
I have a field that holds an integer value. I want to only show the value
of a remainder if there is one.
=Fields!IDCount.Value, Mod 2
What I am looking for is if the number is not even, then by having a
remainder when dividing by two will prove it is an odd number.
I keep getting the message "The value expression for the field
â'=(Fields!IDCount.Value, Mod 2)â' contains an error: [BC30198] ')' expected".
Any help would be greatI think you need something like the following as an expression for that
field;
=Iif (Fields!IDCount.Value Mod 2,
Code.RemainderHelp(Fields!IDCount.Value, 0),
Code.RemainderHelp(Fields!IDCount.Value,1))
So you would have a function in the custom code area called
RemainderHelp which formatted the output approprately depending on if
you passed in 0 or 1. I think something like that might work.
Make sense?

Wednesday, March 21, 2012

Mixing Aggregated data with non-aggregated data in a cube.

At this stage in the project I have a simple fact table which currently holds the low level data. I have designed and built a cube around this table and everything works fine with the current data.

The next stage of the project is to migrate some data into the cube from another business area. The problem is that this data is already grouped. I would like to display this data in the same cube so the users can at least get an overview of the different business areas. Is this practical and doable or are there caveats to doing this?

Does anyone have any suggestions as to what the best approach would be?

The classic approach to this problem is to create another measure group for the new set of data, and set the granularity of that measure group to match the granularity of data. I.e., if in the original measure group, the granularity by Time was Day, in the new one it might be set to Month. Some dimensions may be missing from the new measure group altogether etc.

Mosha.

|||

Interesting.... so is this what I need to do..(an educated guess):

Add the data to the same table|||

Since data is at different granularities - I suggest you keep it in different tables, not in the same table.

Once everything is done - you will be able to use your cube from Excel pivot tables or any other client tool. You will have multiple measures, some of them at one granularity and some at another.