.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

Month To date caluclation MDX..Please help

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :Sql Server

I am a very new bie to SSAS/MDX. I am developing a report on existing  ssas cube. My report shud be sme thing like this

                  Todays date       M2D





A,B,C are measures in my cube . So I want to create caluclated members for sum(A),sum(B),Sum(C) between startday of month and today.So that I can drag caluclated members into my report. I have trsansaction date as dimension. Please help me in regarding . Looks simple but not getting enough hands on doing this.

Thanks in advance. Awaiting for the reply.



View Complete Post

More Related Resource Links

Crawler fails to register date properties of user profiles with the month of January, April, August


This seems to be a bug when the crawler search the user profiles in MOSS 2007.  When crawled, user profiles with a SPS-HireDate in the months of January, April, August and December will be detected, but a full-text (SQL) search returns those profiles without the HireDate field.

User profiles with HireDates in other months work correctly, returning the HireDate in the search.  And changing the month of a problematic user profile also fixes the problem.

This problem is also reflected in the fact that while we have 499 user profiles using the SPS-HireDate property,  the managed property page from the search section only has 350 items with the HireDate property.

We're running MOSS 2007 32bit with SP2 with an English language base and the Spanish language pack. I'd considered date format problems, but I can't imagine how some months would work, while others wouldn't.

Any ideas?

How to create a calcuated member, which will always return the date one month before the currentmemb

I need to create a calculated member in the cube script, which will be subsequently used in various other script calculations.  It needs to return the date, which is 1 month before the currentmember of the Date dimension. I tried something like this: CREATE MEMBER CURRENTCUBE.[Measures].[LastPD]   AS           PARALLELPERIOD([Date].[Calendar].[Month], 1, [Date].[Calendar].currentMember) ,VISIBLE = 1; However when I then try to check the values with this query: SELECT [Measures].[LastPD] on 0, [Date].[Calendar].[Date].members on 1 FROM [TravCSAT] ; I only get NULLs for [LastPD].  Any idea what I am doing wrong?

Date format for Year, Year-Month, and Date (Year-Month-Day) where input is not known

I have a requirement to capture historical events in a table. Now some events will have only Year, some Year/Month, and remaining where Date is known. We should be able to store them in the column and be able to sort etc. When publishing the information, we should be able to publish as was the input, Year only, Year-Month only, or Date. I looked at the newer Date data type. I can insert a 4 digit year, but on retrieving it is YYYY-01-01. I do not know if it has input YYYY or YYYY-MM-DD and is indeed a Date or a Year. I am trying to avoid saving the format information in another column or something. For sorting, when records have same Year, I would have another column to do relative sorting... So question is - what are my best options with SQL/Entity Framework combo. And what others have done, when encountering similar - if any. Thanks in advance. --Sharad 

Retrieve month name and last 2 digit of yr from date column

Table contain one column [d_matur] [datetime] NULL 2014-06-20 00:00:00.000 2015-03-20 00:00:00.000 like this now I want to retrieve month name like June as well as last two digit of year like 14 if anyone know query how to get these from above column please let me know.Thanks

first date of previous month?

How to get the first date of previous month?
PS.Shakeer Hussain Hyderabad

Send a reminder email 1 month before renewal date




I have a custom list with information about our customers and when we need to renew there equipment. When we add entries to the list we have field called Renewal date where we select the date the equipment needs renewing.


I would like to create a workflow so I can select the entry click on workflows and set the entry to email me 1 month before the renewal is due.


I am using SBS 2008 and WSS 3.0


Thanks in advance

Query acting weird.. larger date range works in 1min 26sec and a smaller range say 1 month - 3 month


I have no clue why my query is acting weird

If i try to run it for 1/1/2010 9/30/2010 the query takes around 1min 26 sec and  return around a million rows

and If i run for 8/1/2010 to 8/31/2010 it takes forever to it...

basically i am getting data from 5 tables and putting it in a temp table and then updating that temp table 2-3 times with some information and then displaying it.

I am stumped as to why it works fast for a longer date range and runs the  snail for a small period of time..

I am in the verge of pulling my hair and going crazy..

any help will be appreciated.




check if date in last month

How can i check if the date is in last month

Ignore date and consider month and year to match


Hi there,

It is required to retrieve the records where ONLY Start Month, Year AND End Month, Year are passed. Trying below SQL to get these with no success. 

registrationdate BETWEEN(MONTH((registrationdate) = 01) AND (Year(registrationdate)= 2009)) AND ((Month(registrationdate) =03) AND (Year(registrationdate)=2010))


Help is appreciated.

need of Ascending order based on the Date and month.


Hi friends,

query.Append("SELECT Name, Sex, Marital_Status, Dob, Anniversary, Mobile, Email FROM Client WHERE ");

            if (startDate > new DateTime() && endDate > new DateTime())
                query.Append("(DATEADD(YEAR,DATEDIFF(YEAR, DOB,'" + startDate + "'),DOB) BETWEEN '" + startDate + "'AND'" + endDate + "' OR DATEADD(YEAR,DATEDIFF(YEAR, ANNIVERSARY,'" + startDate + "'),ANNIVERSARY) BETWEEN '" + startDate + "'AND'" + endDate + "') AND ");
           if (!string.IsNullOrEmpty(maritalStatus) && !string.Equals("All", maritalStatus))
                query.Append(" Marital_Status = '" + maritalStatus + "'");

            string resultQuery = query.ToString();
            if (resultQuery.Trim().EndsWith("AND", StringComparison.OrdinalIgnoreCase))
                int lastIndex = resultQuery.LastIndexOf("AND");
                resultQuery = resultQuery.Remove(lastIndex, 3);

            if (resultQuery.Trim().EndsWith("WHERE"))
                int lastIndex = resultQuery.LastIndexOf("WHER

asp JScript date of the month


I was wondering if there was a asp JScript function that will tell me what week of the month it today is. 
I mean F Oct 8 2010 = 2 week of the month  and S Oct 10 2010 = 3rd week of the month 

I was wondering if there was a asp JScript function that will tell me what week of the month it today is. 

I mean F Oct 8 2010 = 2 week of the month  and S Oct 10 2010 = 3rd week of the month 


sql query for month and year of date

I have a table with smallint columns for day,month,year. Now I want to select data lets say for month 10,year 2009 to month 2,year 2010. Can anyone help me in writing this query?

Time Dimension for YTD using assigned Month and Year integers without Date datatype


Hi, most time dimensions are setup using a base Date field in the fact table, and they have plenty of issues for time analysis as it is. However my fact sales records have the time aspect assigned by pre-calculated periods, because depending on various factors, monthly final invoices are all raised on varying days (usually 2nd friday of month but can change). The monthly period is therefore not a straight calendar month. Probably a very common scenario.

So, the invoicing system already assigns the year (ie 2009, 2010, 2011) and monthly period (1, 2, 3 ... 12 with 3 representing march, even though that might represent 13th march to 9th april) and I want to use those as Time dim so we can do YTD, growth-on-prev-year etc.

It looks like its best to setup 2 Dimensions to link to 2 DataColumns/Attributes in the Fact table (say, FYear and FMonth, both integers). That way I can assigned attribute names like March to key column 3. If I combined them into 1 dimension with both fields making up a single key column, would have to either repeat the month names or link it to another Star schema I believe.

I can use the Add Business Intelligence wizard to make the Dimensions into Time ones instead of regular but I'm still not totally sure if this is the best structure/method and once done, how to use the YTD calcs to show in the cube browser (and my MDX knowle

Finding the minimum date for every month in a table.



I have a table that stores the date for every day of the month. I need to get the minimum date for every month thats in the table. So, my table shows the report as below

ssrs report with todays date and end of month


Hello All,

Iam bit sruggling to get an idea how to create report which needs to populate data based on every day to end of month,

what i mean is , dataset

1  day of month data to end day of month data

2nd  dayof month to end day of month data




and so on

I.e i need generate a report based on two paramerts which should take current date for evry day and end  day of month 


Any ideas will be of great help 





Matrix Report With Month/Year Columns - Display date even when there are no records for that month


I've created a matrix report that displays the quantity of different products  set to expire by month/year. The stored procedure returns records for a variety of products and each record contains an expiration date. If there are no products/records that contain an expiration date of lets say 6/2010 then 6/2010 will not appear as a column in the report.

I need a way to force these month/year columns to appear in the report.


Does anyone have a suggestion on how I can make that happen?


Rick Dowdall


function to calculate number of business days in a month for a given date


hi ,

Is there any function to calculate number of business days in a month for a particular date.  my input would be just a single date



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