.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Create a dimension based on 2 fields

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :Sql Server
Hello I have a table as follow: No   Placestart    Placeend 1      DK                USA 2      UK                USA 3      USA              DK Now, I want a dimension called Country, which selects either of the rows where a value exist In SQL it would be ex (SELECT * FROM table WHERE placestart = 'USA' OR placeend = 'USA) So, when I select USA in the dimension all 3 rows are listed, as USA is included either in placestart or placeend. If I select DK row 1 and 3 is selected etc... Is this somehow possible?      

View Complete Post

More Related Resource Links

How do i create dimension based on this query



I have cube called client distinct cube.. that cube is been driven by table A and has the following columns

Client-id, Active ,mcd Elibigle and time_Id

and there another table called Eligibles which has the following columns

Client_id, Time_Id, Plan_Id, plan_Id can be 1 -5


I have a created a dimension called client insurance with table eligbles as the base table and i have added 2 more tables called ben-plans and insurance to get the names for it...

SO when i build this dimension i get the STate, and medicaid and its subsidiarys

the dimension and fact tables for this cube is matched by Client ID and when i process this cube and i get 260 distinct clients for med C but if i query those two table for the same time frame i should 620 distinct instead of 260.. I am not sure what i am doing wrong...

basically i want the dimension to be build by the following query

Select distinct a.client-id from tbl_a a, tbl_eligibles e where a.client-Id = e.client-Id and a.time-Id = 54121 and e.time-Id =54121 and e.plan_ID = 5

Any help will be appreciated.



Create user control fields based on bound properties



I am creating a user control that I would like to be able to generate the form entry fields based on what custom data object the form is bound to. Basically, I have a drop-down box that allows the user to pick what type of data object they are working with (user, address, etc.) That choice will bind the user control to the related data object. No big deal there. I am stuck, however, on how to generate the form fields based on the properties of the object. I feel like I have seen examples of this in WPF but am not able to find them now. All form fields will be simple label, textbox combinations in a stackpanel.

I know more detial will probably be required. Let me know what specifically you would like to know. Any help of direction is greatly appreciated.



Create ID (uniqueid?) from two fields when data is entered


I need to create an ID from two fields when they are entered into the db for the first time.  I thought Uniqueidentifer would do this, but it looks like uniqueidentifier is random and i have no control of the process. 

My user will enter 4 letters into a column called INIT and 4 numbers into a column called NUMB.  What I would like to do is create an id by combining those fields.

How can I do this?



Want to create Page URL rewrite based on Users GUID and Display name?



I am using the asp.net membership. 

On my site I have a Profile.aspx page.

In the code behind of this page,  i get the logged in UserId (Guid) and pass

this to a method in my DAL. GetUserByUserId()


In my database I have a Table called Member which the method gets the data from

and displays details on the page about  the user.


What I want to happen is when they have logged in and are diverted to Profile.aspx,

the page URL shows www.MyWebSite/Profile/UsersName 

for example



is this possible. In my Member table I have FirstName and LastName columns or do I get the

name from the membership table.


even better would be they go straight to www.MyWebsite/JohnSmith.aspx


thank you for any help






display non measure, non dimension fields in drill down

Hi All, I created my fact table with more fields than just the foreign keys linking dimensions and the field(s) to be used as mesures.  I did this hoping that on drill down I would be able to see the extra fields so that the user would have access to detail information on the records making up the measure amount.  The extra fields do not appear on drill down.  How can I make them appear, or am I on the wrong track? Thanks for any help

How can create site in sharepoint foundation 2010 based on WSS 3.0 template(.stp file)

Hi,   I  want  to migrate wss3.0  site into sharepoint foundation 2010 site . earlier we  were creating site based on .stp file  in WSS 4.0 . but now we  have   to build same site in sharepoint foundation 2010. I followed  the old way  intall the .stp file  and  based on that trying to create new  site  but getting some error  old version template is not supporetd my this version. how could  l able to create  site  in sharepoint foundation 2010 based on wss 3.0 template . Please help Thanks in advance Jandel Singh

How can create site in sharepoint foundation 2010 based on WSS 3.0 template(.stp file)

Hi,   I  want  to migrate wss3.0  site into sharepoint foundation 2010 site . earlier we  were creating site based on .stp file  in WSS 4.0 . but now we  have   to build same site in sharepoint foundation 2010. I followed  the old way  intall the .stp file  and  based on that trying to create new  site  but getting some error  old version template is not supporetd my this version. how could  l able to create  site  in sharepoint foundation 2010 based on wss 3.0 template . Please help Thanks in advance Jandel Singh

Create a progress bar based on progress of AJAX handler

I've got a plain C# web page that uses jQuery to call a handler page using AJAX. While the handler content is loading, a message "Please Wait, loading..." is displayed. Once I've got the content back from the handler I hide the loading message and display the content.What I'd like to do is after the loading message, display a percentage of how far through the handler page is. All the handler page does is loop through a list of members, powered by a web service, and adds them to the database so I know exactly how many members are being added to the database so I can tell how far I am through.The problem I'm having is because all of this goes on in a handler, how can I send the progress percentage back to the main web page while the handler was still loading.Any ideas? If I could do the exact same task but differently which would allow me to create the progress bar, I'd be happy to hear any suggestions.

How to Create an MDX Query Parameter to Select 30 Values from a Dimension?

Hi, I'm using SSRS 2005 to report on an SSAS cube that contains a Procedure dimension.  I don't need to use members of this dimension in my report, but rather need to select records (patients) where their chart has one or more of the codes.  I've researched this today and cannot locate the best approach.  Thus far, I've attempted to create an MDX query parameter as part of my dataset.  However, I don't know whether this is the correct approach, and how to structure the syntax so that only records with one or more procedures are included in the report?  If so, what is the proper MDX syntax for setting my Procedure code equal to the query parameter? Thanks, Sid

create multiple columsn based on a passed in variable

Hi, I am clueless as to how the following would be done. Would appreciate imputs: i would be passed in a StartDate and EndDate along with a Period(Week,Month,Quarter,Year).  this would be an INT which is calculated in the following way -- Suppose he selects StartDate = 2010-01-01, EndDate = 2010-02-28, and Period = Weeks ---> Which would mean my resultset would have a additional 9 columns (9 weeks using DateDiff(Week,@startdate,@enddate) The number of fixed columns always will be 4 Total # of records that would always come back is > 10 something like this CategoryTypeId(int),ParentCategory(uniqueidentifier),Id(uniqueidentifier),Name nvarchar(50),Wk1,Wk2.....Wk9 1,xxxx,xxxx,'Shopping',650,300,1275....1000   (i dont't need to total the wk,month,qurter or yearly.This would be taken care on the front end) Thanks!

Shell Dimension - Not Time based

Hi   I am creating a shell dimension to create a hierarchy.  The idea is we want to know how much revenue we make from new accounts.  So I have created an account dimension and linked that to the Revenue fact.  I also created a Fact linked to the Date and User dims that will show the date the user was created.  By doing this, I was able to create a calculated measure that will show me total revenue, plus the revenue that is only for new players for a specific month: with member NewRev as aggregate( exists(DESCENDANTS([User Account].[User Account].[All], [User Account].[User Account].[User Account Key]) , [Date].[Date - Calendar Month].currentmember , "User Registration") , [Measures].[Revenue])   select {[Measures].[Revenue]  , NewRev} on columns , [Date].[Date - Calendar Month].[Calendar Month].&[201008] on rows from [Revenue] Sorry it is a bit messy, testing at the moment. What I would like to do is create a shell dimensions so I can create a hierarchy that will show new and returning players as members.  It would have an all level, or the user could split the revenue by this dim.  I set things up like the Time calculations shell dim, but am a bit stuck with how to create the mdx so that it will work with any measure. What would I change to do this? Regards Michael

Running sum calculation based off date dimension?

I have a fairly simple calculated measure which does a running sum of a particular measure : --This does a running sum of the Net Measure up until the previous date (basically a "Starting Count" for a period. Sum(PeriodsToDate([Change Date].[Year - Month - Date].Levels(0), [Change Date].[Year - Month - Date].PrevMember), [Measures].[Net]) The problem is I have added a second hierarchy in the date dimension that includes quarter called [Year - Quarter - Month - Date]. Is there anyway around not having to create a seperate running sum calculated measure to use this new hierarchy? The PrevMember in the initial calculated measure works, although it reports the wrong number when used in conjunction with the Quarter hierarchy because it gets the PrevMember in the other hierarchy. What is the best practice for this situation?Craig

Dimension member based on period

Hi, I have done several SSAS cubes in the past, but this is the first time I have run into this problem. I have tried searching for an answer online, but I am unsure of how to pose my question/search appropriately. After many hours of searching (someone MUST have run into this before), I thought I'd try the forum. I will be using SQL 2005 SSAS. The issue concerns a dimension that is linked to my fact table via a middle table that creates a many-to-many relationship. This middle table contains a date that the cube would need to be filtered on (which would be a further dimension, I assume). Note that I plan on allowing reporting on the cube via MS Excel (pivot tables). My table structure (highly simplified for testing purposes, it contains upwards of 15 other dimensions) is laid out as follows: --dimension = RecordableInjury CREATE TABLE [dbo].[safe_RecordableInjury](  [RecordableInjuryID] [int] NOT NULL,  [RecordableInjury] [varchar](100) NOT NULL,  [RecordableInjuryShort] [varchar](5) NOT NULL ) --fact = Injury (the measure on this table will be a distinct count of InjuryID) CREATE TABLE [dbo].[test_Injury](  [InjuryID] [int] NOT NULL,  [IncidentDate] [int] NOT NULL ) --joiner between fact table & RecordableInjury dimension CREATE TABLE [dbo].[test_InjuryRecordability](  [InjuryID] [int] NOT NULL,  [StatusDate] [int] NOT NULL,

How to create one instance of COM object that can be accessed from custom fields/workflows

Hi, Ive got a COM-object that is used to perform some actions on another server, and i can use only one instance of it ... But : 1. my custom fields must interact with it for fetching data 2. my custom workflows must interact with it for posting data So the question is : How to create only one instance of COM-object which can be fully accessible from custom fields/workflows ( custom too ) Thanks :)

Create Lookup Site Column based on External List (SharePoint 2010)


I've got an External List and I want to create a Site Column, which is Lookup to a column in my external list. If I tick any of the columns in 'Add a column to show each of these additional fields' and click OK i get the following error message:

[NullReferenceException: Object reference not set to an instance of an object.]
  Microsoft.SharePoint.SPBusinessDataField.IsInDefaultView() +58
  Microsoft.SharePoint.SPBusinessDataField.CreateSpFieldForBdcType(String bdcName, Boolean hidden, Boolean readOnly, Boolean idField, SPAddFieldOptions op) +809
  Microsoft.SharePoint.SPBusinessDataField.AddNeededSecondaryFields(String wssNames, String[] oldNames, String[] newNames, SPAddFieldOptions op) +315
  Microsoft.SharePoint.SPBusinessDataField.OnAdded(SPAddFieldOptions op) +240
  Microsoft.SharePoint.SPFieldCollection.AddFieldAsXmlInternal(String schemaXml, Boolean addToDefaultView, SPAddFieldOptions op, Boolean isMigration, Boolean fResetCTCol) +759
  Microsoft.SharePoint.SPFieldCollection.Add(SPField field) +61
  Microsoft.SharePoint.ApplicationPages.FieldNewPage.Save() +513
  Microsoft.SharePoint.ApplicationPages.FieldNewPage.BtnOk_Click(Object sender, EventArgs e) +46
  System.Web.UI.WebControls.Button.OnClick(EventArgs e) +114
  System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +139

Please Help with Defining Calculated Measure based on Dimension Members



The issue looks pretty simple yet I got stuck. I want to define the measure [NR Var] as [NR]-[F NR] for years/months/dates before 2009 and [NR]-[FI NR] for 2009 and on. I am using [Year]-[Month]-[Date] hierarchies in the cube. I have defined scope:

Scope ([Measures].[NR Var], {
descendants([Date].[Year - Month - Date].[Year].&[2004], 2, self_before_after),
descendants([Date].[Year - Month - Date].[Year].&[2005], 2, self_before_after),
descendants([Date].[Year - Month - Date].[Year].&[2006], 2, self_before_after),
descendants([Date].[Year - Month - Date].[Year].&[2007], 2, self_before_after),
descendants([Date].[Year - Month - Date].[Year].&[2008], 2, self_before_after)});
this=[NR]-[F NR];
End Scope;

but it does not work for some reason. If I get rid of DESCENDANTS function, it works but applies the scope only to the YEAR level. Another problem with using SCOPE is that it affects [NR Var] only yet I have other calcs derivative of [NR Var] which I want the scope to affect as well.

So I ideally I would like to have something like:



case when {
descendants([Date].[Year - Month - Date].[Year].&[2004], 2, self_before_after),
descendants([Date].[Year - Month - Date].[Year].&[2005], 2, self_befor

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend