SSRS Expression Current month in a Fiscal calendar dimension from a SSAS cube
How to create an expression for a default SSRS parameter to a SSAS cube when using i Fiscal Year calendar - and where I want to show current Calendar month and year (for example February 2014)
This is an example of my Time dimension for February 2014:
[Time].[FiscalYMD].[Fiscal_Year].&[2013].&[10]
The fiscal calendar goes from May - May - which means that April 2014
would look like this:
[Time].[FiscalYMD].[Fiscal_Year].&[2013].&[12]
and May 2014 would look like this:
[Time].[FiscalYMD].[Fiscal_Year].&[2014].&[01]
Please advise
Hi HCMJ,
To represent the fiscal calendar, you shift the current date by 4 months back. Then you can do:
="[Time].[FiscalYMD].[Fiscal_Year].&[" & Year( DateAdd( "m", -4, Today() ) ) & "].&[" & Month( DateAdd( "m", -4, Today() ) ) & "]"
It just gets the year and month of '4 months ago'. I have not tested it, but I guess it should work.
Regards
Andrew Borg Cardona
Similar Messages
-
Hot to select last month sales using fiscal calendar
Hi All,
I have the following query listed below
select DISTINCT
-1,
vODS_GLBalance_test.Page,
vODS_GLBalance_test.FiscalYearId,
vODS_GLBalance_test.FiscalMonthOfYearId,
GLAmount
From ODS.Staging.vODS_GLBalance_Test
Left Outer Join Ods.JJill.tODS_GLBalance
ON tODS_GLBalance.FiscalYearId = vODS_GLBalance_Test.FiscalYearId
AND tODS_GLBalance.FiscalMonthOfYearId = vODS_GLBalance_Test.FiscalMonthOfYearId
AND tODS_GLBalance.Page = vODS_GLBalance_Test.PAGE
where vODS_GLBalance_Test.fiscalyearid = YEAR(GETDATE())
AND vODS_GLBalance_Test.fiscalMonthofyearId = MONTH(GETDATE())-1
The query runs fine and gives me the exact data if we are in lets say 2014 and months > 3.But my issue here is i am using a fiscal calendar and fiscal calendar months is not always MONTH(GETDATE())-1, for ex if we are in feb 2014 then the logic above will
give us Jan 2014 but it should give me jan 2013 as the fiscal year starts from feb and ends in jan.
Can someone please help me with any suggestions?
Thanks.Hi Naomi,
Thanks for the reply as i was waiting for the answer i tried this one and looks like its working as our calendar month is always +1 of fiscal month
select DISTINCT
-1,
vODS_GLBalance_test.Page,
vODS_GLBalance_test.FiscalYearId,
vODS_GLBalance_test.FiscalMonthOfYearId,
GLAmount
From ODS.Staging.vODS_GLBalance_Test
Left Outer Join Ods.JJill.tODS_GLBalance
ON tODS_GLBalance.FiscalYearId = vODS_GLBalance_Test.FiscalYearId
AND tODS_GLBalance.FiscalMonthOfYearId = vODS_GLBalance_Test.FiscalMonthOfYearId
AND tODS_GLBalance.Page = vODS_GLBalance_Test.PAGE
where vODS_GLBalance_Test.calendaryearid = YEAR(GETDATE())
AND vODS_GLBalance_Test.calendarMonthofyearId = MONTH(GETDATE())
I am not sure if you have remembered but i was struggling with bringing past 3 months sales to update, do you think something of this logic may help us anyway?
Any suggestions please?
Thanks -
SSRS Expression to compare two values and get data from another dataset
Hi,
I have a requirement where in i need to compare a value of a dataset (not the one which table is poiting to)
with the value of a text box, and return the count if it matches else 0, the expression is as below. Here
industryName and recCount are from the dataset ds_MedimOrLowImpactEntities. whats wrong in this expression
=Sum(IIF(Fields!industryName.Value = reportItems!hpapra_name.Value, Fields!RecCount.Value, 0), "ds_MediumOrLowImpactEntities")
This is the error that i am getting:
Any help on this is appreciated
Kruthi HegdeHi Kruthi,
After testing the issue in my local environment, I can reproduce it. Just the error message said, “Aggregate function can be used only on report items contained in page headers and footers”. So the sum function that contains report items should be stayed
at page headers or footers. Besides, you said the hpapra_name textbox contain a field from another dataset, not the ds_MedimOrLowImpactEntities dataset. While in Reporting Services, Report item expressions can only refer to other report items within the same
grouping scope or a containing grouping scope. So consider the two issues, we should use some other expression to instead the “reportItems!hpapra_name.Value” expression.
Take a look at the "Looking up values from another dataset" topic here:
http://msdn.microsoft.com/en-us/library/ms159673.aspx#LookupFunctions
Hope this helps.
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
How to show current date in a column of dimension table in ssas
Hi,
I have 2 dimension tables (ALLWORK and YOURWORK) and 1 measure table (STATS). In ALLWORK dim table, I have 4 columns, one of them is END_DATE. Based on END_DATE and current date I want to create a named calculation field. To achieve this, I
want to show the current date in 5th column (of ALLWORK dim table) as calculated member (as named calculation wont show me correct date).
Problem is, I am not able to create the column in the dimension table. While creating the calculated member, I am not able to select the ALLWORK dimension table, it always selects MEASURE by default. Please help.
thanks
Tarique
thanks and regards Tarique AslamHi Tarique,
According to your description, you want to add a column to your dimension to show the current date, right?
In data source view, we can add named calculation to your table. A named calculation is a SQL expression represented as a calculated column. This expression appears and behaves as a column in the table. A named calculation lets you extend the relational
schema of existing tables or views in a data source view without modifying the tables or views in the underlying data source.
Reference
http://msdn.microsoft.com/en-in/library/ms174859.aspx
http://devmau5.wordpress.com/2010/03/25/the-getdate-of-mdx/
If I have anything misunderstand, please point it out.
Regards,
Charlie Liao
TechNet Community Support -
Multiple Fiscal Calendar in a single context
Hi,
I know that for each context we can only have one PAS database, as a result, only a single Fiscal Calendar definition for a each context.
My question is: there is any way of creating a workaround for this? I need to have in a single context KPI's that use different fiscal calendar's
Thanks in advance for the tips
Regards
PedroHi Bob,
so, if I understand correctly there is only two options:
1 - Have a single PAS database with a single fiscal calendar and use that in a single Context. The user's will have the option to then create specific reports for the metrics that should be displayed using a different Fiscal (using for that the different options in time that already exist in the reports component).
2 - Create an individual PAS database for each Fiscal and have a different context for each of those databases.
Is like this?
If you think strategically, that shouldn't change the usefullness of Strategy Management, since the status of objectives and KPIs will still be driven off your current numbers, whatever the fiscal calendar.
Yes, but for instance if we have KPI's that use Fiscal form Jan to Dec and other from Jul to Jun, when we select yearly data for 2009 for example, the information displayed for both is not the "same". For KPI1 is from Jul 2009 to Jun 2010 when it should be Jan 2009 to Dec 2009 (this for a database with Fiscal Calendar starting at "Jul"). Is not like this?
PS: It's strange than no one have this problem in the past. Is not normal to have a customer that want to see in the same Scorecard/Context, KPI's that use different Fiscal calendar?
Thanks in advance
Pedro
Edited by: Pedro S. Costa on Sep 23, 2009 5:11 PM -
Rollover 18 weeks starting from week number of current month
Hi,
I have a requirement as described below.
Table Name Time:
Columns: Fiscal Year, Fiscal Month and Fiscal Week
above table has join with sales table and it contain sales data on week basis. so least granularity of data at week level.
we have a report with columns fiscal year, actual sales and forcast sales. our requirement is to filter the data with following criteria.
Current Month Filter
Jan fiscal week between 1-18 of current year
Feb fiscal week between 5-23 of current year
March fiscal week between 9-27 of current year
November fiscal week between week 44 of current year and week 10 of next year
December
so with above requirement we need to filter data with rollover 18 weeks starting from week number of current month
I tried with timestampadd(sql_tsi_week, interval, week) but it's not working as I expacting. Please provide the code/logic to get it done.
Appreciate your help.
Thanks
Jay.Jay wrote:
I need to get rollover 18 week data at anypoint of time starting with week number of 1st of every month to 18 weeks. read my question again and you will be able to understand.You're kind of missing the point to be honest. It's very hard to answer specific questions without the required information. To answer a question like this we need a minimum of:
1. Oracle version
2. Sample data (CREATE TABLE / INSERT statements)
3. Expected output
4. Explanation of business rules.
Alternatively, you can read the link in my original response.
Please provide the required information and someone can help. -
I need to return the first day of the current month. I have read I can use:
WITH MEMBER [Measures].[FirstDayOfMonth] AS
DateSerial(Year(Now()), Month(Now()), 1)
However, this returns an incorrect format. Can this date member be formatted to yyyy-MM-dd?
I have also read I can use OpeningPeriod but I could not get this to work.
My date Hierarchy is:
[Date].[Year Month Day].[Month]
And my month members are in the yyy-MM-dd format, for example:
[Date].[Year Month Day].[Month].&[2015-02-01]Thanks Richard,
I am not sure what the "aa" string is for?
Yes, I can get the current date using:
WITH
MEMBER [Measures].[Month Day] AS
FORMAT(Now(), "yyyy-MM-dd")
But I need to return the first date of the current month dynamically. For example, today this value would be:
[Date].[Year Month Day].[Month].&[2015-02-01]
So I cannot use Parent or FirstChild as the hierarchy will not recognise the
FORMAT(Now(), "yyyy-MM-dd") as a month member as it returns 2015-02-18.
I believe I need to extract the current month day value, subtract this value from the Now() and add 1 (start of month), for example:
StrToMember("[Date].[Year Month Day].[Month ].&[" + FORMAT(Now()-[Month Day]+1,
"yyyy-MM-dd") +"]")
Which will be 2015-02-18 - 18 + 1 = 2015-02-01
Or:
WITH
MEMBER [Measures].[Month Day] AS
FORMAT(Now()-[Month Day Value]+1, "yyyy-MM-dd")
SET [FirstOfMonth] AS
StrToMember("[Date].[Year Month Day].[Month].&[" + [Measures].[Month Day] +"]")
So I need a new member to return the month day value.
Does this make sense? Is there a better way to do this? -
Please help. I have a matrix report. In the report I have row group PO Type. One the Column groups I have a parent group by Fiscal Year, and then a child group by Month. When I run the report, I get two years of data back broken
out by month. Please see below.
Now here is where I am getting stuck. I need to take the variance between the current month of the current year, from the same month of the prior year. So I need to show the difference between Oct , 2014 from Oct, 2013. November, 2014 from November
2013... etc. etc.
In the example below, how do I create a column or row showing the variance for Contracts for October 2014. I need to take the contracts for October 2014 which is 3 and subtract that from October 2013 which is 8. Any suggestions? How do I do that
for each month? Then I need to do it for the quarter... then the year? But I'll be happy if I can just get the month working first.
Any help will be appreciated.
here is what my rdl file looks like.
Here is what my report looks like when I render it.Hi Adrian_s2012,
According to your description, you want to compare values for the month of current year with the month of prior year and get the variance. Right?
In Reporting Services, we don't have any function to get this "Year to Year" Growth. In this scenario, if you data source is a cube, we suggest you use Analysis Services to achieve your requirement. If this data source is just from database, it will be hardly
to calculate the variance because we need to compare the values within every two different column group and matrix generate adjacent columns one by one. Even we make it by using custom, every time executing the long code when generating result
in a cell will reduce a lot of performance, we really don't suggest to do that in SSRS. Here is a thread with much easier requirement, please take a reference of that:
http://social.msdn.microsoft.com/Forums/office/en-US/842e2dcb-d949-4297-9d91-eac989692cb5/difference-between-the-grouped-column?forum=sqlreportingservices
If you have any question, please feel free to ask.
Best Regards,
Simon Hou -
SSRS Date parameter - current month from SSAS cube
I have a SSAS cube with a date dimension called Posting Period and now I would like to have my report parameter using this date dimension to show the current month.
So far I have worked out the following expression which are working(Fiscal year calendar going from May to May) for the year component - but I can't figure out how to get it to work on Quarter date part (and the month) so as you can see
the Quarter and month is hardcoded in the below expression:
="[PostingPeriod].[Posting Period].[Year].&[" + CStr(Year(Today())-1) + "].&[Q4].&[10]”
Any help would be appriciated.
TxHi HCMJ,
In your scenario, you use the expression
="[PostingPeriod].[Posting Period].[Year].&[" + CStr(Year(Today())-1) + "].&[Q4].&[10]”
to set the default value of the parameter and then use it in the MDX query, right?
If in this case, you can use the expression below
="[PostingPeriod].[Posting Period].[Year].&[2013].&[Q" & DatePart(DateInterval.Quarter,today()) & "].&[10]”
to set the value on Quarter date part.
And it returns:
If I have anything misunderstood, please point it out and elaborate the meaning of "but I can't figure out how to get it to work on Quarter date part (and the month) so as you can see the Quarter and month is hardcoded
", so that we can make further analysis.
Regards,
Charlie Liao
TechNet Community Support -
Expression - First date and last date of current month, current year
Hi
I need to have 2 ssrs expression as I can use as default parameters in my report where I can - out from my Time dimension, get the
first date of the current, current year - and one where I get last date, current month, current year.
My data source is a SSAS cube and my timedimension is structured like this:
[Time].[Days].&[2009-01-16T00:00:00]
Any suggestions how to solve this ?Hi ,
You can use below in Default Values in ssrs ;
for first Day of current month and year
="[Time].[Days].&[" +Format(dateadd("m",0,dateserial(year(Today),month(Today),1)), "yyyy-MM-dd")+"T00:00:00]"
output will be ;
[Time].[Days].&[2014-09-01T00:00:00]
For last day of current month and year
="[Time].[Days].&[" +Format(DateSerial(Year(Now()), Month(Now()), "1").AddMonths(1).AddDays(-1), "yyyy-MM-dd")+"T00:00:00]"
output will be ;
[Time].[Days].&[2014-09-30T00:00:00]
Please correct me if I misunderstood your requirement.
Thanks
Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. -
I am trying to create a function within my select statement that will return the fiscal month number. My company's fiscal calendar starts on October 1. The first problem I had is I wasn't sure if there was any easy way to just say if the current month is
X return Y. Instead, I had to use the full date, because the function I knew of would just say "When date is between A and B..." The problem there is I will have to update it every so often with new years, and removing past years so as to avoid
the query getting too large. Is there any way to instead just use the month? Then, I could just say "If current month is X return Y," and it wouldn't matter the year. Either way, below is what I used. When I try to preview it in Visual Studio 2008,
I am getting an error saying "The conversion of a varchar data type to a datetime data type resulted in an out-of-range value."
I've seen some questions here regarding fiscal calendars in the past, but I've never understood the answers people have given. I have found that a little confusing, so I was hoping this simpler (even if not necessarily ideal) solution I found would help.
Unfortunately, I am getting an error, so obviously it did not. Does anybody have any advice they can offer to get this to work?
Select
CASE
WHEN GETDATE() Between '20131001 00:00:00' AND '20131031 11:59:59' THEN '1'
WHEN GETDATE() Between '20131101 00:00:00' AND '20131131 11:59:59' THEN '2'
WHEN GETDATE() Between '20131201 00:00:00' AND '20131231 11:59:59' THEN '3'
WHEN GETDATE() Between '20140101 00:00:00' AND '20140131 11:59:59' THEN '4'
WHEN GETDATE() Between '20140201 00:00:00' AND '20140228 11:59:59' THEN '5'
WHEN GETDATE() Between '20140301 00:00:00' AND '20140331 11:59:59' THEN '6'
WHEN GETDATE() Between '20140401 00:00:00' AND '20140430 11:59:59' THEN '7'
WHEN GETDATE() Between '20140501 00:00:00' AND '20140531 11:59:59' THEN '8'
WHEN GETDATE() Between '20140601 00:00:00' AND '20140630 11:59:59' THEN '9'
WHEN GETDATE() Between '20140701 00:00:00' AND '20140731 11:59:59' THEN '10'
WHEN GETDATE() Between '20140801 00:00:00' AND '20140831 11:59:59' THEN '11'
WHEN GETDATE() Between '20140901 00:00:00' AND '20140930 11:59:59' THEN '12'
WHEN GETDATE() Between '20141001 00:00:00' AND '20141031 11:59:59' THEN '1'
WHEN GETDATE() Between '20141101 00:00:00' AND '20141131 11:59:59' THEN '2'
WHEN GETDATE() Between '20141201 00:00:00' AND '20141231 11:59:59' THEN '3'
WHEN GETDATE() Between '20150101 00:00:00' AND '20150131 11:59:59' THEN '4'
WHEN GETDATE() Between '20150201 00:00:00' AND '20150228 11:59:59' THEN '5'
WHEN GETDATE() Between '20150301 00:00:00' AND '20150331 11:59:59' THEN '6'
WHEN GETDATE() Between '20150401 00:00:00' AND '20150430 11:59:59' THEN '7'
WHEN GETDATE() Between '20150501 00:00:00' AND '20150531 11:59:59' THEN '8'
WHEN GETDATE() Between '20150601 00:00:00' AND '20150630 11:59:59' THEN '9'
WHEN GETDATE() Between '20150701 00:00:00' AND '20150731 11:59:59' THEN '10'
WHEN GETDATE() Between '20150801 00:00:00' AND '20150831 11:59:59' THEN '11'
WHEN GETDATE() Between '20150901 00:00:00' AND '20150930 11:59:59' THEN '12'
WHEN GETDATE() Between '20151001 00:00:00' AND '20151031 11:59:59' THEN '1'
WHEN GETDATE() Between '20151101 00:00:00' AND '20151131 11:59:59' THEN '2'
WHEN GETDATE() Between '20151201 00:00:00' AND '20151231 11:59:59' THEN '3'
WHEN GETDATE() Between '20160101 00:00:00' AND '20160131 11:59:59' THEN '4'
WHEN GETDATE() Between '20160201 00:00:00' AND '20160228 11:59:59' THEN '5'
WHEN GETDATE() Between '20160301 00:00:00' AND '20160331 11:59:59' THEN '6'
WHEN GETDATE() Between '20160401 00:00:00' AND '20160430 11:59:59' THEN '7'
WHEN GETDATE() Between '20160501 00:00:00' AND '20160531 11:59:59' THEN '8'
WHEN GETDATE() Between '20160601 00:00:00' AND '20160630 11:59:59' THEN '9'
WHEN GETDATE() Between '20160701 00:00:00' AND '20160731 11:59:59' THEN '10'
WHEN GETDATE() Between '20160801 00:00:00' AND '20160831 11:59:59' THEN '11'
WHEN GETDATE() Between '20160901 00:00:00' AND '20160930 11:59:59' THEN '12' END
FiscalMonthNbrFunny enough, I think I may have just answered my own question. I'm not sure why the above does not work, so I would still be interested to hear that if anybody can explain and offer another solution.
However, I realized I should be able to instead do something along the lines of:
CASE
WHEN MONTH(GETDATE()) = '10' THEN '1'
WHEN MONT(GETDATE()) = '11' THEN '2' END
FiscalMonthNbr
I am just showing the first two months to give you the idea of wht I mean. Coincidentally, I have to run to a meeting and therefore cannot test this yet, but I will try it once I get back, and come back here to let folks know if it worked. -
Issues with statistical modeling in calendar months vs 13 fiscal periods
In our demand planning, we plan at the fiscal period level (13 fiscal periods across a year - not matching with calendar months or year). We are having issues (strange results) trying to run the statistical modeling at the fiscal period level versus the calendar month level. Is there a way to run the stat modeling over fiscal periods rather than calendar months? Can we run stat modeling over a specific date range rathn than including the current month?
Hi Stephen, I guess I can assume the following:
1) In the master forecast profile, you have maintained the period indicator and the fiscal year variant
2) You are choosing a forecast strategy in univariate profile (?) that makes use of seasonality, and you are trying to maintain the number of periods in a season as 13 (in our case, our periods are custom, but there are still 12 periods, so different from your case)
3) Your history horizon in master forecast profile is more than the number of periods in the season i.e. history has more than 13 periods of data
If above things are already done and you still face issue when you try to use 13 periods in a season, looks to me like a SAP bug, and it would be best to raise an OSS message to SAP. -
BI Content Variable on 0Calday for first day of the fiscal year and first day of the current month
Hi Friends,
In one of my BEx queries, I need to restrict a key figure for 0Calday based on the first day of the current fiscal year. And another key figure for the first day of the current month. Instead of using Customer exit, I hope there is some SAP delivered standard variable for these filters.
Please let me know if there is anything available for this. Your answers will be highly appreciated.
Thanks & Regards,
RanjanHi Ranjan,
Please find below standard variables.
Pls check below link for more.
Standard Variables in BEX related to Time Charcteristics
Characteristic
Variable
Description
0CALDAY
0CWD
Current Workday (SAP Exit)
0CALDAY
0CYTCD
Cumulated to Current Day (SAP Exit)
0CALDAY
0DAT
Current Calendar Day (SAP Exit)
0CALDAY
0DAY_***
Cumulation of all Values to Key Date (SAP-Exit)
0CALDAY
0LYTCLD
Cumulated to Current Day of Previous Year
0CALDAY
0LYTCLD
Previous Year Cumulated to Current Day (SAP Exit)
0CALDAY
0L_DATE
Last Calendar Date
0CALDAY
0P_LY_R
Comparative Period for Last Year
0CALDAY
0P_TY_R
Period for Current Year up to Yesterday
0CALDAY
0S_KDATE
Key Date Interval for Previous Year (SAP Exit)
0CALDAY
0S_KDAY
Key Date Interval Current Year (SAP Exit)
Best,
SATYA. -
Calendar to get week number of current month
Hi All,
Description: Currently I am working on an application which require to calculate some data for current month from a database where I have the data of all the previous and current month of that year, I can take week number as criteria.
Help Required: I can find week of month or year using Calendar methods but how to find the first week on the current month only.
Lets suppose the current month is April so when I use, int weekofmonth = cal.get(cal.WEEK_OF_MONTH);
it will return me the number of present week however I want to get what would be the week number at the start of the month (April).
Hope I am able to describe my query properly.
Thanks in advance.
Amit/ ====================================================
Method: Get the desired Date format for the date
Developed By: Sandip Waghole [29-Jan-2010]
==================================================== /
public String getWeekNo(String strDate)
// input Date Format : M/dd/yyyy
int weekNo=0,i=0;
String strWeekNo=null;
int noOfDaysInTheYear=365;
int WEEK_STARTS_ON = 1; // Define the day on which week starts Sunday/Monday 1:Sunday 2:Monday
int firstDayNoInFirstWeekOfPresentYear=0; // Inititalize teh day on which week is starting in present year
int firstDayOfPresentYear=0; // Inititlize the 1st day of the present year whether Sunday/Monday/.....
int[] monthDaysArray = {31,28,31,30,31,30,31,31,30,31,30,31}; // Define array of the days as per months
int todaysDayNoInPresentYear=0;
int daysLateByFirstWeekStartedAfterYearStarted=0;
int intTemp=0;
//strDate="08/24/2000"; // For test purpose
StringTokenizer strDateTok = new StringTokenizer(strDate, "/ ");
int month = Integer.parseInt(strDateTok.nextToken());
int day= Integer.parseInt(strDateTok.nextToken());
int year = Integer.parseInt(strDateTok.nextToken());
GregorianCalendar cal = new GregorianCalendar();
// Check if present year is leap year
boolean boolIsLeapYear = cal.isLeapYear(year);
// If it is boolean year then add 1 to total days in the year & add one more day to february
if(boolIsLeapYear)
noOfDaysInTheYear=noOfDaysInTheYear+1;
monthDaysArray[1]=monthDaysArray[1]1;
// Find the 1st day of this year
Calendar calObj = new GregorianCalendar(year, Calendar.JANUARY, 1);
firstDayOfPresentYear = calObj.get(Calendar.DAY_OF_WEEK);
int intRemoveNoOfDaysFromWeek=0;
// # Find the day no of prsent day
for(i=0;i<month;i+) // get no of days till present year
intTemp = intTemp monthDaysArray;
todaysDayNoInPresentYear = intTemp - (monthDaysArray[month-1]-day);
if(firstDayOfPresentYear==6 || firstDayOfPresentYear==7) // If first Day is Friday or Saturday then it is week
// Identify the the day no on which 1st week of present year is starting
firstDayNoInFirstWeekOfPresentYear = 7 - firstDayOfPresentYear WEEK_STARTS_ON 1;
// Find delay in the 1st week start after r=the year start
daysLateByFirstWeekStartedAfterYearStarted = firstDayNoInFirstWeekOfPresentYear - 1;
// Now week is starting from Sunday
weekNo = (Integer)((todaysDayNoInPresentYear-daysLateByFirstWeekStartedAfterYearStarted)/7);
// Find the day no of today
intTemp = (todaysDayNoInPresentYear-daysLateByFirstWeekStartedAfterYearStarted) % 7;
if(intTemp > 0)
weekNo=weekNo+1;
else
weekNo=weekNo;
else
// 1st week is starting on 1st Of January
firstDayNoInFirstWeekOfPresentYear=firstDayOfPresentYear;
// Remove no. of days from the 1st week as week is starting from odd Sunday/Monday/Tuesday/Wednesday/Thursday
intRemoveNoOfDaysFromWeek = 7-firstDayOfPresentYear 1; // 1 added as include start day also
// So one week will be added in no. of weeks
weekNo = (Integer)((todaysDayNoInPresentYear-intRemoveNoOfDaysFromWeek)/7);
// Find the day no of today
intTemp = (todaysDayNoInPresentYear-intRemoveNoOfDaysFromWeek) % 7;
weekNo = weekNo +1; // As 1st weeks days are reduced from the todays day no in the year
if(intTemp > 0)
weekNo=weekNo+1;
else
weekNo=weekNo;
// Remove the no. of days from the week 1
strWeekNo=Integer.toString(weekNo);
return strWeekNo;
// Any issues please mail on [email protected] or [email protected] -
Hi All;
I have a field called createdon
Using this field i need to create the SSRS expression for the table as below
Any help much appreciated
Thanks
Pradnya07use expressions as below
assuming this is to be done in SSRS
Today
=COUNT(IIF(
DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
Yesterday
=COUNT(IIF(
DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
LastWeek
=COUNT(IIF(
DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
Last fortnight
=COUNT(IIF(
(DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1)
Or (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-2),Fields!YourRequiredField.Value,Nothing))
Last Month
=COUNT(IIF(DateDiff(DateInterval.Month,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Month,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
Year To Date
=COUNT(IIF(DateDiff(DateInterval.Year,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Year,Cdate("01/01/1900"),Now())
And
DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) <= DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
Maybe you are looking for
-
Problems with bootcamp on Mac mini (Mavericks) late 2009
Hi all! The problem I encounter is that I get an error message saying that the files aren't available on the software update server (?). I don't get to the point where to partition the hdd or in my case the ssd. I have tried with an external 500 gb h
-
HT5085 I bought music on my iPhone and cannot download from the cloud to my macbook pro.
I have done this in the past with no problem. My computer is a Macbook Pro and is activated for my itunes account. I manually search or the songs Ive bought on my iphone and can see it says purchased but its grey and not clickable. I dont understand
-
How can i apply gradient...
I have a rectangular shape movie Clip (Size :130px X40 px). I want to apply linear gradient on it using action script. Can anybody help me how can I apply gradient on it. Note: This movie clip is made manually. Not by using createEmptyMovieClip metho
-
Sound blaster Upmixed surround sound Vs Home Theatre syste
Is there anyone has used Sound Blaster (any kind) to Upmix the stereo sound to surround (5.,6. or 7.) by hooking up to the home theatre system? Please help tell me the surround sound of which one (by using Sound Blaster upmixing or Home theatre syste
-
GL ACCOUNT CANNOT BE DIRECTLY POSTED!!!!!!!
I am getting an error when trying to post to an GL account xxxx , That account cannot be directly posted . My question is do we need to make any changes to Commitment item.I have assigned this GL account to commitment item as DPMADE. And i have marke