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


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

Beginner MDX Question how do i get Last member with data

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :Sql Server
 
I'm pretty new to Mdx, and have only used it a few times before. So this is probably a really simple question.

First and foremost, I trying to get the Last Week with Data(or last completed week) from the system (it should be Week 9, which is 201009). 
Secondly, I need sums for the last 4 , 13, and 52 weeks. I tried using the LastPeriod function which seems to work perfectly, if only i could get the SUMS of these, instead of each period individually. How do i sum a last period? 
So it should look like this
LWK         L4WK         L13WK         L52WK
598          3000          12000          87000


Thanks for the help!

SELECT {
([Measures].[PL Gross Sales Amt], [Time].[Fiscal Week].&[201009]) ,
([Measures].[PL Gross Sales Amt] , LASTPERIODS (4,[Time].[Fiscal Week].&[201009])),
([Measures].[PL Gross Sales Amt], LASTPERIODS (13,[Time].[Fiscal Week].&[201009])),
([Measures].[PL Gross Sales Amt], LASTPERIODS (52,[Time].[Fiscal Week].&[201009]))
 
}
ON COLUMNS,
{
[Time].[Fiscal Year]
}
ON ROWS
FROM [SALES]
WHERE ([Source].[Sources].[Description].&[Posted Navision Sales], 
[Bill To Cust


View Complete Post


More Related Resource Links

A simple Data Modeling Question

  

I have a data modeling question that hopefully this fictious example will help explain.  My application is data driven and the classes reflect the tables to a large degree.   In this example my database has two tables:

  • VendorMaster with an int Primary Key of VendorID
  • VendorContact with an int Primary Key of ContactID

The VendorContact table also has a Foreign Key of VendorID in order to associate the contact with a specific Vendor.  In this example a Vendor can only have one contact.

My question is how to represent these two tables in terms of classes.  In my current design I have two classes:

  • VendorMaster
  • VendorContact

In order to represent the relationship between a VendorMaster and VendorContact, my VendorMaster class contains a property called VendorContact.

My questions are about the VendorContact class and how it represents the relationship between a VendorMaster and itself.

Option #1

The VendorContact class should contain an int property of VendorID

Option #2

The VendorContact class should contain a VendorMaster Property

I am not sure which option is the 'best' option to take. My concern is that if I go with option #2 that I would create a cyclical relationship between the VendorMaster and Vendo

Simple data binding question

  
Newbie binding question here: is it possible to bind a control in XAML to a StaticResource by passing in the key via a data structure? Basically something like this: <TextBlock Text="{Binding ImageKey}" /> <Image Source="{StaticResource ResourceKey={Binding ImageKey}}" /> <-- doesn't work   The TextBlock binding on the first line works correctly, it extracts the key of the StaticResource from my data structure and displays it correctly. What I'm trying to do is get the Image control to bind to the StaticResource with that name (which happens to be a BitmapImage).      

Data Mining Solution Question

  
Hi, I am working for a company that would like to use Aanalysis Services for predictive analytics. My problem is that there are only 40 or so months worth of data. I am wondering if this is enough to even make anything relevant and/or accurate.   So far I've made a time series mining structure, that just uses the booking number as input and predict. I am having a hard time justifying this as they view it as something that could have just been done in excel.   Also I have made a neural network. The company has several (continuous) metrics that they track along with bookings. So I made a neural network to use these inputs to predict the bookings.   This made another problem. The prediction that the neural network makes is different from the next month that that time series predicts and is causing distrust by the potential end users.   I've thought about combining the two models. I could use the output of the neural net and do a natural prediction join of that result into the time series.   Seeking advice, and something that I can do with Analysis Services that could be useful to a company with only a small number of months of data to work with.   -S

SQL server 2008 r2 Data sync question???

  
Sql 2008 r2 data sync, does it involve a db hosted by microsoft or does that involve us hosting the sync functionality locally?  I know we have db's local that need to be sync'd across a wan but does that happen in a db hosted in the ms cloud or does that have to do with a sync functionality that runs locally to keep my db's sync'd?   Thanks, SL

I need a workflow triggered by a workflow...how do I design this? Beginner question

  
I've added the Approval workflow to a forms library and it generates the necessary tasks and emails for 2 levels (serial) of Approval on the form. When the form has been approved the 2nd time, I want it to trigger another workflow that notifies a 3rd person of the existence of the form and assigns her a separate non-approval task. I'm creating it in SharePoint Designer, and I can do most of it, but I'm not sure what field I'm looking for, at the beginning in order to start the workflow. Currently, there is no column for Approval Status in the form library, only a column that shows the status of the workflow (In Progress or Approved).  I tried If Workflow Status equals Approved then email.... but that didn't work. Any help is greatly appreciated.  I'm looking for the data source field and the list item field and value, I guess.  

Data Mining Solution Question

  
Hi, I am working for a company that would like to use Aanalysis Services for predictive analytics. My problem is that there are only 40 or so months worth of data. I am wondering if this is enough to even make anything relevant and/or accurate.   So far I've made a time series mining structure, that just uses the booking number as input and predict. I am having a hard time justifying this as they view it as something that could have just been done in excel.   Also I have made a neural network. The company has several (continuous) metrics that they track along with bookings. So I made a neural network to use these inputs to predict the bookings.   This made another problem. The prediction that the neural network makes is different from the next month that that time series predicts and is causing distrust by the potential end users.   I've thought about combining the two models. I could use the output of the neural net and do a natural prediction join of that result into the time series.   Seeking advice, and something that I can do with Analysis Services that could be useful to a company with only a small number of months of data to work with.   -S

Question about quality of data

  
Hello, Thanks for the help on the last question.  We have looked at several open source offers in the field of data integration. We are now wanting data quality software to complete our data integration program.  Do packages exist to suit our needs? Would you know of innovative data quality programs? Thanks to all!

Beginner question about eliminating Dups

  
I looked at a couple of links about eliminating dups. One  link suggested RowNUmber() function which is fine for 2005 (but I wanted something that would also work on 2000).  Another link was a MS article advising to select the dups into a temporary table. http://support.microsoft.com/kb/139444/en-us I found this article confusing, and I don't see why it suggests we need a holding table. So I propose this approach - is there any reason NOT to do it my way? (Is there a bug here I'm overlooking?) IF EXISTS(SELECT 1 FROM sys.tables WHERE NAME = 'Facilities' ) DROP Table dbo.Facilities; CREATE TABLE [dbo].[Facilities] ( [ID] int IDENTITY, [FacNo] varChar(3) , [theState] varchar(2) ) INSERT INTO Facilities ([FacNo], theState)VALUES ('1', 'FL') INSERT INTO Facilities ([FacNo], theState)VALUES ('7', 'FL') INSERT INTO Facilities ([FacNo], theState)VALUES ('25', 'FL') --- DUPLICATE THE FIRST THREE ROWS INSERT INTO Facilities ([FacNo], theState)VALUES ('1', 'FL') INSERT INTO Facilities ([FacNo], theState)VALUES ('7', 'FL') INSERT INTO Facilities ([FacNo], theState)VALUES ('25', 'FL') -- ADD some new rows. INSERT INTO Facilities ([FacNo], theState)VALUES ('4', 'VA' ) INSERT INTO Facilities ([FacNo], theState)VALUES ('5', 'VA' ) INSERT INTO Facilities ([FacNo], theState)VALUES ('10','Va') INSERT INTO

Another basic Data Binding question

  
3 days ago (thanks to Olaf) I was able to make progress with binding a data collection to a DataGrid. Since then I have searched the web in vain for a VB example to enable me to switch off the DataGrid AutoGenerateColumns and enter my own columns and appropriate Paths to the Collection’s properties.   The following code works fine but I can’t work out how to enter my own individual columns etc. Can anyone give me the syntax for an example of one column please?   Why is it so difficult to find VB examples of WPF demos etc? (Nearly everything is in C#.)   I have some experience in Access VB so have picked VB in trying to use WPF. I would be grateful for any links to VB WPF resources. Option Explicit On Option Strict On Imports System.Collections.ObjectModel Partial Public Class DataGrid_FilledFromCodeBehind Private _ocEng As ObservableCollection(Of EnPlayer) Public Property EngSqd() As ObservableCollection(Of EnPlayer) Get Return _ocEng End Get Set(ByVal value As ObservableCollection(Of EnPlayer)) _ocEng = value End Set End Property Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded _ocEng = New ObservableCollection(Of EnPlayer)() For i = 0 To 4 EngSqd.Add(New EnPlayer(ref(i), names(i), ages(i), bat(i))) Next Me.DataCon

Basic Data Access question (ObjectDisposedExpection)

  
I am just starting to look at .NET 4.0 and Entity Framework 4 and having trouble finding the best way to achieve something. I'll explain with a quick example:I got my CategoryManager class that looks like this:public sealed class CategoryManager { public System.Data.Objects.ObjectSet<Category> Categories { get { try { StoreEntities storeDb = new StoreEntities();                    using (storeDb)                    {                        return storeDb.Categories;                    } } catch (Exception) { //TODO  throw; } } } public List<string> GetCategoryNames() { try { var categories = from category in this.Categories select category.Name; return categories.ToList();

question on async data mirroring

  

In Async (high perf) data mirroring, if the primary goes down and it has some items which were committed on primary but were not relayed to the secondary. (may be there were in the send queue).

What happens to those?

Will I have to force the mirror server to come up (thereby loosing the data in the queue?).

In this scenario, is there a less destructive way where I don't end up loosing the data which was committed on the primary (apart from switching to high-safety).


SSAS Data Member Issue

  

Hi all,

I am using SQL 2005 - SSAS- Calculations tab to create data member. I am using two numeric columns from the fact table to create a data member, after that I use calculation properties "associated measure group' to link with the fact table. Now it is showing in perspective tab at the bottom.

But for some reason it's NOT SHOWING IN THE FACT TABLE in  browser tab where I am viewing some resutls.

Please let me know what I did wrong? Or if I missed something?

Thanks,

Amir


AA

Question of using CASE and IF statements for a calcuated member using MDX

  

I have a calculated member called 'MemberCounts = [Total # of members/#of month'] which calculate the number of members per month. For example, Total number of members in 2007 is 12,000. If user is looking at the Year level in the date hierarchy then Membercounts = 12,000/(#of months = 12) = 1000. If a quarter has been selected then MemberCounts = 12,000/(#of months = 3) = 12,000/3 = 4000 and at the month level, it will be 12,000/1 = 12,000.

Definition:

CASE

WHEN [AdmitDate].[Hierarchy].currentmember.level is

     [Admitdate].[Hierarchy].[Year]

THEN

     [Measures].[Members]/12

WHEN

      WHEN [AdmitDate].[Hierarchy].currentmember.level is

     [Admitdate].[Hierarchie].[Quarter]

THEN

     [Measures].[Members]/3

ELSE

     [Measures].[Members]

 

This works perfect for every year and its quarter until the current year.  

Requirement: For the current quarter (Quat-3) of Year (2010), the [Measures].[Members] field for month of Sept. is 0. (It will be populated at the end of the month).

By default, the calculated member defined by

Pipeline Data Cube Design Question

  

 

The Analysis team wants to analyze sales pipeline data. Our CRM system(Source system) send the Data Warehouse team transaction as the Product moves through the different stages.

 

To mention a few: Creation, CallMade,LeadEngaged,CreditCheck,PapersReceived,Closed.There are more than 100 tracking statuses like mentioned above.

 

Sample transactions fact table:

ID LeadID

security question about dynamic data

  

apologies if this has been answered before.

it seems that the scaffolding that generates the list, edit, details apsx pages uses querystrings to pass the primary key for the relevant record. thus is i have a list.aspx showing me a grid of records, the edit hyperlink will be something like http://../tblTable/edit.aspx?ID=n where n is the key of the record to edit.

however, obviously this is not secure for a multi-user site as someone else with a valid login could potentially see records which they shouldnt simply by trying different "ID=n" values?

is there a way to change this behaviour in a Dynamic Data site or will i have to manually code to ensure a user only see records intended for them?

any help is gratefully appreciated

John

 


Using Sharepoint 2003 - Data Security Question

  
We need to limit visibility of data in a datasheet to users based on their ID, NOT on who created or loaded the data.  If this is possible, how do we accomplish this?

I have a newbe question about sql standard 2008, How do I merge 1 row of data from another DB to the

  

Hi everyone,

 I am new to data base type work. I have very little exsperience in database code. I set up an application that retrieves data from the UI that has four forms. The application calculates and modifies this data for storage in different fields in a database. The application itself is not very simple as to the operation of the print and rs232 operations. But I have all of that code written and have written code for updateing the local db with this information. I was able thru searches to find enough information to update the local db.

 I have not been able to find any code example for merging 1 row of data from one DB to another DB. That has the same data table and fields in both data bases.  Now these DB's are set up exactly same except for DB name and Table name. They have exactly the same field and column names. The only difference is the data in the primary key field, the database that is local builds two rows that the key field has the same data except for one letter and is build at different times. The remote data base has the same data in the key field except it does not have the letter at the end of the data.

 Local data base    Key                     Re

Categories: 
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