Average YTD in SSRS
The image above is a replica of a report that already exist. Now users want to see average Year to Day(YTD) per for each product. The idea is to aggregate the sum of each product and divide by the count of months. This report is group by month by year.
I understand using Window Function but I am running Sql Server 2008 so cannot frame. How do I go about this using SSRS?
Zionlite
Hi Zionlite,
Could you provide some sample data in form of a CREATE temporary table or CTE declaration?
Your example looks odd to me, als YTD Sum does not align with MTD Sums. Maybe you are calculating on a fiscal year and calculation does not start with january....but even then it's odd to me that YTD Sales Tables is 50 in January, 100 (not 50+10 = 60)
in February and dops back to 50 in March ?!
Regarding alternatives to framing via Window Functions Itzik Ben Gan suggests two alternativ methods in his book "Microsoft SQL Server 2012 HIgh-Performance T-SQL USing Window Functions".
Here an excerpt of the code provided by him. Maybe that helps already.
-- FIRST_VALUE, LAST_VALUE, NTH_VALUE
-- FIRST_VALUE, LAST_VALUE as window functions
SELECT custid, orderdate, orderid, val,
FIRST_VALUE(val) OVER(PARTITION BY custid
ORDER BY orderdate, orderid) AS val_firstorder,
LAST_VALUE(val) OVER(PARTITION BY custid
ORDER BY orderdate, orderid
ROWS BETWEEN CURRENT ROW
AND UNBOUNDED FOLLOWING) AS val_lastorder
FROM Sales.OrderValues;
custid orderdate orderid val val_firstorder val_lastorder
1 2007-08-25 10643 814.50 814.50 933.50
1 2007-10-03 10692 878.00 814.50 933.50
1 2007-10-13 10702 330.00 814.50 933.50
1 2008-01-15 10835 845.80 814.50 933.50
1 2008-03-16 10952 471.20 814.50 933.50
1 2008-04-09 11011 933.50 814.50 933.50
2 2006-09-18 10308 88.80 88.80 514.40
2 2007-08-08 10625 479.75 88.80 514.40
2 2007-11-28 10759 320.00 88.80 514.40
2 2008-03-04 10926 514.40 88.80 514.40
3 2006-11-27 10365 403.20 403.20 660.00
3 2007-04-15 10507 749.06 403.20 660.00
3 2007-05-13 10535 1940.85 403.20 660.00
3 2007-06-19 10573 2082.00 403.20 660.00
3 2007-09-22 10677 813.37 403.20 660.00
3 2007-09-25 10682 375.50 403.20 660.00
3 2008-01-28 10856 660.00 403.20 660.00
-- returning one row per customer
WITH C AS
SELECT custid,
FIRST_VALUE(val) OVER(PARTITION BY custid
ORDER BY orderdate, orderid) AS val_firstorder,
LAST_VALUE(val) OVER(PARTITION BY custid
ORDER BY orderdate, orderid
ROWS BETWEEN CURRENT ROW
AND UNBOUNDED FOLLOWING) AS val_lastorder,
ROW_NUMBER() OVER(PARTITION BY custid ORDER BY (SELECT NULL)) AS rownum
FROM Sales.OrderValues
SELECT custid, val_firstorder, val_lastorder
FROM C
WHERE rownum = 1;
custid val_firstorder val_lastorder
1 814.50 933.50
2 88.80 514.40
3 403.20 660.00
4 480.00 491.50
5 1488.80 1835.70
6 149.00 858.00
7 1176.00 730.00
8 982.00 224.00
9 88.50 792.75
10 1832.80 525.00
-- pre SQL Server 2012 solutions
-- Using row numbers
WITH OrdersRN AS
SELECT custid, val,
ROW_NUMBER() OVER(PARTITION BY custid
ORDER BY orderdate, orderid) AS rna,
ROW_NUMBER() OVER(PARTITION BY custid
ORDER BY orderdate DESC, orderid DESC) AS rnd
FROM Sales.OrderValues
SELECT custid,
MAX(CASE WHEN rna = 1 THEN val END) AS firstorderval,
MAX(CASE WHEN rnd = 1 THEN val END) AS lastorderval,
MAX(CASE WHEN rna = 3 THEN val END) AS thirdorderval
FROM OrdersRN
GROUP BY custid;
custid firstorderval lastorderval thirdorderval
1 814.50 933.50 330.00
2 88.80 514.40 320.00
3 403.20 660.00 1940.85
4 480.00 491.50 407.70
5 1488.80 1835.70 2222.40
6 149.00 858.00 330.00
7 1176.00 730.00 7390.20
8 982.00 224.00 224.00
9 88.50 792.75 1549.60
10 1832.80 525.00 966.80
-- using carry-along-sort technique
-- step 1: create concatenated strings
SELECT custid,
CONVERT(CHAR(8), orderdate, 112)
+ STR(orderid, 10)
+ STR(val, 14, 2)
COLLATE Latin1_General_BIN2 AS s
FROM Sales.OrderValues;
custid s
85 20060704 10248 440.00
79 20060705 10249 1863.40
34 20060708 10250 1552.60
84 20060708 10251 654.06
76 20060709 10252 3597.90
34 20060710 10253 1444.80
14 20060711 10254 556.62
68 20060712 10255 2490.50
88 20060715 10256 517.80
35 20060716 10257 1119.90
-- step 2: group, aggregate and extract
WITH C AS
SELECT custid,
CONVERT(CHAR(8), orderdate, 112)
+ STR(orderid, 10)
+ STR(val, 14, 2)
COLLATE Latin1_General_BIN2 AS s
FROM Sales.OrderValues
SELECT custid,
CAST(SUBSTRING(MIN(s), 19, 14) AS NUMERIC(12, 2)) AS firstorderval,
CAST(SUBSTRING(MAX(s), 19, 14) AS NUMERIC(12, 2)) AS lastorderval
FROM C
GROUP BY custid;
custid firstorderval lastorderval
1 814.50 933.50
2 88.80 514.40
3 403.20 660.00
4 480.00 491.50
5 1488.80 1835.70
6 149.00 858.00
7 1176.00 730.00
8 982.00 224.00
9 88.50 792.75
10 1832.80 525.00
-- in case ordering element supports negative values, e.g., orderid
WITH C AS
SELECT custid,
CONVERT(CHAR(8), orderdate, 112)
+ CASE SIGN(orderid) WHEN -1 THEN '0' ELSE '1' END -- negative sorts before nonnegative
+ STR(CASE SIGN(orderid)
WHEN -1 THEN 2147483648 -- if negative add abs(minnegative)
ELSE 0
END + orderid, 10)
+ STR(val, 14, 2)
COLLATE Latin1_General_BIN2 AS s
FROM Sales.OrderValues
SELECT custid,
CAST(SUBSTRING(MIN(s), 20, 14) AS NUMERIC(12, 2)) AS firstorderval,
CAST(SUBSTRING(MAX(s), 20, 14) AS NUMERIC(12, 2)) AS lastorderval
FROM C
GROUP BY custid;
Cheers
Martin
Similar Messages
-
Customer exit code to calculate Average YTD.
Hi Experts,
I want to create new column ( AVGYTD TRGT) in Bex report for folling data .( Which is FF data).
I have created one formula variable(zfmvavgytd) of type customer exit. and strucked at coding part.
so that, anybody provide customer exit code for required column(avgytd trgt). and details are as follows.
0CALMONTH ENO ENAME PERDAY_ TRGT
04.2011 1 ABC 100
04.2011 2 BCD 200
05.2011 1 ABC 200
05.2011 2 BCD 200
06.2011 1 ABC 300
06.2011 2 BCD 200
07.2011 1 ABC 200
07.2011 2 BCD 200
till 03.2012
Now I want to display the column for ( AVG YTD_TRGT) based on "0calmonth " & " ENo " as below
AVG YTD_TRGT
100
200
150
200
200
200
200
200
calculation behind this is...
for 04 .2011 --empno(1) ---100/1
for 04 .2011 --empno(2) ---200/1
for 05 .2011 --empno(1) ---200+100/2
for 05 .2011 --empno(1) ---200+200/2
for 06 .2011 --empno(1) ---300200100/3
for 06 .2011 --empno(1) ---200200200/3
for 07 .2011 --empno(1) ---200300200+100/4
for 07 .2011 --empno(1) ---200200200+200/4First you need to calcualte the YTD and then Average YTD.
Year to Date (YTD) u2013 From the 1st to entered u201CKey Dateu201D for the current year.
Average Year to Date - YTD divided by the u201CNo of Daysu201D in year till u201CKey Dateu201D for current year.
Check the below code for getting Previous YTD....next create a Selection restrict the KF with YTD varaible
Below is sample code for reference.
to calculate "Previous year to date" (User input Calday u2013 key date)
WHEN 'ZDAYPYR'.
IF I_STEP = 2. "after the popup
LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
WHERE VNAM = 'ZPDATE'.
CLEAR L_S_RANGE.
L_S_RANGE-LOW = LOC_VAR_RANGE-LOW.
L_S_RANGE-LOW(4) = L_S_RANGE-LOW(4) - 1. "low value previos year
v_loc_date = L_S_RANGE-LOW. "take input value in another variable
L_S_RANGE-LOW+4(4) = '0101'.
L_S_RANGE-HIGH = v_loc_date. "high value = input, taken into another variable
L_S_RANGE-SIGN = 'I'.
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
EXIT.
ENDLOOP.
ENDIF. -
Hoe to calculate "average YTD target"
Hi Experts,
I have a requirement in Bex report .
the data will be like as follows...
0calmonth empnumber empname perday-target AvGYTD-target
04.2011 2 abc1 100 100
04.2011 3 abc2 200 200
04.2011 4 abc3 300 300
04.2011 5 abc4 400 400
05.2011 2 abc1 500 300 for reference ( 500+100 /2) based on empnumber
05.2011 3 abc2 600 400 for reference ( 600+200 /2)
05.2011 4 abc3 700 500 for reference ( 700+300 /2)
05.2011 5 abc4 100 250 for reference ( 100+400 /2)
06.2011 2 abc1 600 400 ( 600500100/3)
06.2011 3 abc2 700 500 ( 700600200/3)
06.2011 4 abc3 800 600 ( 800700300/3)
06.2011 5 abc4 100 200 ( 100100400/3)
As above I need to display the column for "AVGytd_target"( Like last column in above table).
can anybody give some suggestions to complete this task.
Thanks in advance,
Regards,
babu.Hi Ajay,
i need the data like 5 th column only .
"AvGYTD-target"
100
200
300
400
300
400
500
250
400
500
600
200
and not below data. ( Its for your reference)
for reference ( 500+100 /2) based on empnumber
for reference ( 600+200 /2)
or reference ( 700+300 /2)
for reference ( 100+400 /2)
( 600500100/3)
( 700600200/3)
( 800700300/3)
( 100100400/3)
Thanks in advance,
babu. -
How to calculate average for a keyfigure based on 0calmonth.
Hi Experts,
I have a requirement in SAP BI is as below.
I have 2 colums in my query 1. 0calmonth ( charactersic) 2. PERDAY TARGET(KF)
Now I want to create a new column t.e. "AVERAGE YTD TARGET" for" PERDAY TARGET" based on "0CALMONTH"
Like, I have 10 records in one month (APRIL) and another month (MAY) having 25 records.
SO I want to display "AVERAGE YTD TARGET " for each record in Report .
so,please let me know the procedure to complete this in BEX query.
Thanks in advance.
Regards,
Surendra babuHi,
Please go through this pdf if you want to know how exception aggrgation works.It will be really helpful for you.
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0b8ed5b-1025-2d10-b193-839cfdf7362a?quicklink=index&overridelayout=true
Regards,
AL -
Hi There,
I have SSRS 2008R2, and I have data source from ssas, has YTD Amount from the cube, I want to add calculation in report to calculate average YTD, so if we are in April, then Avg YTD would be YTD Amount/number of month (4) in this case.
How do I get count of month here
Thanks
DonHi Don,
Per my understanding that you want to get the Avg YTD based on the month number you have selected, right?
I assumed that you have a field may be Date type field to get the month number from and map with an Amount field. I have tested on my local environment and you can create an parameter of the Month, when you select an month number you will get the Avg YTD=SUM(YTD
Amount)/Number.
Details information below for your reference:
Create an parameter(Month) to specify 1,2,3,4,5,6,7,8,9,10,11,12 as the value for the available values of this parameter
add an filter in the Dataset as below to filter the YTD data based on the Month Number:
Expression: =DatePart("m",Fields!Date.Value)
Operator: < =
Value: =Parameters!Month.Value
Using below expression to get the Avg YTD:
=Sum(Fields!YTD_Amount.Value)/SUM(Count(Fields!YTD_Amount.Value))
Or:
=Sum(Fields!YTD_Amount.Value)/Count(Fields!YTD_Amount.Value,"DataSetName")
Preview as below:
If your problem still exists, please try to provide sample data in the table and also the table structure.
Regards
Vicky Liu
If you have any feedback on our support, please click
here.
Vicky Liu
TechNet Community Support -
FRS - Prompt / Y-T-D.
Hi,
I have a report with numerous columns, one of which gets the current period via a prompt - to use in a column that has that periods data, several of which reference this prompt, so I do not ask the user for the same info numerous times.
My problem is that I want to use YTD functionality in conjunction with the prompt from another column - I can find a way to use either one, but not both together - I know this should be simple, can someone help me out please - I know the what just not the how, so a step by step would be helpful...
i.e. I want the equivalent of; -
Y-T-D Same As Column A
Is this possible?
thanks,
Robert.
Edited by: Robert Angel on 03-May-2012 06:09With the layout I mention you don't need to select DTS members. See below steps to get YTD assuming that users will enter current month in the prompt.
Insert a data column
Click on 'functions' tab in member selection area
Select range function
When prompt window pop-up select start member as Jan and end member as 'current POV for period'
*Insert a formula column and use formula with syntax [column] : ex [D] and hide the data column with range function*repeat the same steps or insert an other formula column with [D]/Column[D].countA to get average YTD value.
Sorry if I am totally missing anything here. -
Consolidation in multiple currencies
Hi there,
I would like to translate consolidated results in two different currencies. Let's say, for example, USD and EUR.
Do I need to create two alternative entity hierarchies whose parents def currencies are USD and EUR? Is there any other possible solutions?
Any customized solution would do the job... even if highlight me main technical choices, avoiding to disclosing details of your implementations.
It's very useful to us because we wish to would like to maintain the opportunity to post Contribution Adjs.
PLEASE HELP!!!I will better explain my request:
PREMISE:
No Org by Period app; YTD consolidation
Sub translation manages the convertion applying average YTD rate, opening or closing rate. Some accounts are translated at historical rate. Translation also manages the calculation of the currency translation reserve in equity.
Consolidation manages the split of equity reserves between minority and group shares. This split involves also the currency translation reserve, by debiting the "Currency Translation Reserve" account and crediting the "Currency Translation Reserve - Minority Share" account.
Users need to analyze contribution of each single legal entity (including the split effect) both in USD and EUR. In order to properly translate and consolidate figures the quickest and most reasonable solution would be that of creating two alternative hierarchies (one in USD and in EUR). However this turns into headakes when you have to post Contribution Adjs as these must be posted twice, one time in EUR and the other time in USD.
My question is:
is there a customized approach that allows me to avoid redundancy in posting Contribution Adjs and also reduce the number of alternative hierarchies? Have you ever faced similar issues? How did u solve them?
Many thanks again -
Cumulate value at the Query Level
Hi.
I have a scenario where the user enters the value for Cal Month. With this the query fetches the value for a key figure for the month (based on last value exception aggregation on CALWEEK). Now with this user entry I need to also fetch the cumulative value (YTD) for the same key figure for all the months till the month entered by the user. Subsequent to that I have to calculate the average value of the YTD Value (Average = YTD Value/Number of months). I can not add another Key Figure for cumulation in the cube as there are many many Key Figures like this. Please suggest.
Cheers
AnandThanks Ravi.
I am not sure I understand. I need to calculate both for the month and YTD using the same user entry - that is the month.
Basically the variable has to pass one value to the first column and a range to the next like this
User Entry = CalMonth (mm/yyyy)
CHAR Column 1 Column 2
value For the month YTD
Cheers
Anand
Edited by: Anand Nataraj on Oct 28, 2008 4:40 PM -
Calculating Percent totals and Averages in SSRS
Below is a report created using SSRS. I want to be able to calculate the percentage(%) total to add up to 100 % in the Total column. For some reason my averages are not working as you can see from the table. The idea is to calculate the averages of opportunities
as well as Sold. But from my calculation, things are not adding up as I supposed. This report is not grouped by parent. How do I make this to work as it should? Thank you.
(NB: Please zoom in to view the image)
ZionliteHi,
According to the description, I doubt you may manually add Total and Averages columns. Did you manually add Local and International or they were in a column group?
You can use the following expression for the Opportunity Cost(averages) column in the total row:
=Sum(Fields!opportunitycost.Value)/2
How did you calculate the percentage column? If it is Sold value divided by Opportunity Cost value, use:
=Sum(Fields!sold.Value)/Sum(Fields!opportunitycost.Value)
Also try to define the scope in the expression and see if it make difference.
If there is no progress, please capture the screenshot of your design tab.(Click on the report and capture the image of your report structure)
Also, tell us the expression of the text box which in problem.
Thanks.
Tracy Cai
TechNet Community Support -
How to calculate an average of YTD measures?
Hi all,
I'm working on BPC 10 for NW.
We use an account-type dimension for Personnel inventory (Personnel to fixed-term contracts, to permanent contracts, number of executives, staff etc.).
The corresponding ACCTYPE is AST because people are seen as a balance sheet account measure. So the measure, even if we're in periodic in our model, is stored as a YTD value.
I want to calculate a average with those measures, for instance the average number of contractors from january to the current month, with a member formula. I can't manage to do that with a calculation because I can't add values of YTD measures: when I try a formula like ([ACCOUNT].A1 , [MEASURES].[YTD]) it returns the same value as the periodic value. Whereas the formula works with EXP account type.
The formula I'd like to have in the end would be something like that:
iif(isleaf([TIME].currentmember),avg(YTD(),([Measures].[PERIODIC],[ACCOUNT].[G102])),[TIME].currentmember.lastchild),solve_order=5
This formula works in a previous version of BPC (5.1) but not in BPC 10.
Any idea?
Thanks very much,
Sébastien.Assuming the job always starts at mid-might, you can try something like this:
WITH t AS
(SELECT to_date('01-JUL-2011 07:25:31', 'dd-mon-yyyy hh:mi:ss') AS end_date
FROM dual
UNION
SELECT to_date('02-JUL-2011 07:10:58', 'dd-mon-yyyy hh:mi:ss') AS end_date
FROM dual
UNION
SELECT to_date('01-AUG-2011 07:16:24', 'dd-mon-yyyy hh:mi:ss') AS end_date
FROM dual)
SELECT trunc(end_date, 'mon') AS MONTH,
trunc(end_date, 'mon') + avg(end_date - TRUNC(end_date)) AS AVERAGE_TIME
FROM t
GROUP BY TRUNC(end_date, 'mon'); -
I have created Fixed assets Report , but our auditors would like to see separate Prior YTD Depr in separate column and current book Depr in separate column , right now Prior year YTD depr amd Currrent year depr showing in column Amount Curreny column,
but I would like to show that amount in net column and Current book depr by each to accum and show in where I have $ 710.95 amount , can some one help me how can I change my query to come up what I am looking for, I really need to fix this for
our auditors, and donot to show the details by each month, any help will be really appreciated, you guys are so good, I wish I know more about Sql,
my Query is below
SELECT ASSETTABLE.NAME, ASSETTABLE.ASSETTYPE, ASSETTABLE.QUANTITY, ASSETTABLE.UNITOFMEASURE, ASSETTRANS.TRANSTYPE, ASSETTRANS.ASSETID,
ASSETTRANS.TRANSDATE, ASSETTRANS.DIMENSION2_, ASSETTRANS.AMOUNTMST, ASSETTRANS.ASSETGROUP, ASSETTRANS.DATAAREAID,
ASSETTABLE.UNITCOST
FROM ASSETTABLE INNER JOIN
ASSETTRANS ON ASSETTABLE.ASSETID = ASSETTRANS.ASSETID
WHERE (ASSETTRANS.DATAAREAID = N'AR1') AND (ASSETTRANS.TRANSDATE >= @Paramfromdate) AND (ASSETTRANS.TRANSDATE <= @Paramtodate)
thanks in advanceI don't think I understand exactly what the ask is. What field allows you to distinguish between prior year and current depreciation? TRANSTYPE?
I think your data is fine. I would suggest using a Matrix instead of a table. Just set the column group to group on the field that distinguishes between current and prior year depreciation. Add all of the rest of your column outside the column group so they
are only scoped by your row group(s). You can add those columns either before or after your column group columns.
If you have a lot of work into your report already and don't want to create a new matrix which will require you to recreate the work already done on your table. you can convert the existing table to a matrix as described in this technet wiki article:
http://social.technet.microsoft.com/wiki/contents/articles/21184.ssrs-converting-between-tablix-controls-matrix-table-list.aspx
"You will find a fortune, though it will not be the one you seek." -
Blind Seer, O Brother Where Art Thou
Please Mark posts as answers or helpful so that others may find the fortune they seek. -
Custom measure to calculate average in YTD model
Hi,
I am working in a YTD model which currently has the standard measures: YTD, QTD and periodic. I now need a new custome measure to calculate the average of the YTD values.
So, if on an account I have the following YTD amounts:
month 1: 10
month 2: 20
month 3: 30
I would need the new measure to give me
month 1: 10
month 2: (10+20)/2 = 15
month 3: (10+20+30)/3 = 20
This will also have to work where a month in the middle has a zero value, for example:
month 1: 10
month 2: 0
month 3: 30
I would need the new measure to give me
month 1: 10
month 2: (10+0)/2 = 5
month 3: (10+0+30)/3 = 13.3333333333
Has anyone done this before and would be willing to share the measure formula use with me?
Thanks,
ArnoldSo I've tried to copy the YTD measure and adjust it
IIF([%ACCOUNTDIM%].PROPERTIES("ACCTYPE")="EXP" OR [%ACCOUNTDIM%].PROPERTIES("ACCTYPE")="AST", 1 ,-1)*(([MEASURES].[SIGNEDDATA],CLOSINGPERIOD([%TIMEDIM%].[%TIMEBASELEVEL%]))/[%TIMEDIM%].CURRENTMEMBER.PROPERTIES("MONTHNUM"))
but that doesn't work, whilst I can see the measure I get no values at all. -
Pulling a large set of customer contacts (100,000s of rows) with each row being a contact. I have a crosstab which groups by location and employee, when the detail rows are the types of contacts (in person, telephone, etc) and then I have months across the top. Here's the problem I'm having:
I need to calculate the average # of contacts per business day. I could countdistinct(contact_date) if I were basing the average on the number of days on which contacts occured (for each dept), but the report has to calculate averages for all departments based on the same # of business days per month (21 in January, 19 in February, etc.). If I just put the number of days on each row in the dataset, I could do min or max or avg and it would work fine for the months' averages, but the totals at the end for YTD won't work. I can't sum, because I have the # of business days on each row, so 1000 contacts in a month with 21 days would put a denominator of 21000.
This is how it would look working the way I want it to.Thank Graham,
when i use the same technique of setting up a nested counter and highlighting the fields based on that value...
The counter should be set on every column of the row?
It is because i found there is the problem, when i set the counter on every column...all the row will be highlighted without condition (x<=5), i think the counter may overcounted or not work.
for example..
user action count
1. a 10
2. b 9
3. c 8
4. d 7
5. e 6
when i set the counter (let's say x<=2), on both user and action
i will see the user 1,2 had been highlight and whole action column as well.
and i also struggling with the filtering..
i saw the whitepaper, can it apply in the crosstab? -
Hi There,
I setup Dynamic Time Series YTD, it works correctly for sum aggregation, however, for example, I have employee count per month, in this case, it should be average of sum of employee,
Jan Feb Mar YTD (Mar)
2 3 4
It should be (Jan + Feb + Mar)/3 = 3, however the YTD (Mar) number is not showing correctly, I tag "Total Employee" as TB Average.
Anything I am doing wrong here?I check tech reference:
"Oracle recommends that you avoid assigning time balance properties (First, Last, Average, Skip Missing) to members set for dynamic calculations if you plan to use these members in Dynamic Time Series calculations. Doing so may retrieve incorrect values for the parent members in your accounts dimension."
Is this the reason? If this is the case, then how do we handle YTD for employee count? -
I have a simple column chart grouping on 1 value on the category axis. For simplicity's sake, we are plotting $ amounts grouping by Month on the category axis. I right click on the data series and choose "Add calculated series...". I choose moving average. I want to move the average over at least 2 periods.
When I run the report, I get the error "Formula error - there are not enough data points for the period". The way the report is, I never have a guaranteed number of categories (there could be one or there could be 5). When there is 2 or more, the chart renders fine, however, when there is only 1 value, instead of suppressing the moving average line, I get that error and the chart shows nothing.
I don't think this is entirely acceptable for our end users. At a minimum, I would think the moving average line would be suppressed instead of hiding the entire chart. Does anyone know of any workarounds or do I have to enter another ms. connect bug/design consideration.
Thank you,
DanI was having the same error while trying to plot a moving average across 7 days. The work around I found was rather simple.
If you right click your report in the solution explorer and select "View Code" it will give you the underlying XML of the report. Find the entry for the value of your calculated series and enter a formula to dynamically create your periods.
<ChartFormulaParameter Name="Period">
<Value>=IIf(Count(Fields!Calls.Value) >= 7 ,7, (Count(Fields!Calls.Value)))</Value>
</ChartFormulaParameter>
What I'm doing here is getting the row count of records returned in the chart. If the returned rows are greater than or equal to 7 (The amount of days I want the average) it will set the points to 7. If not, it will set the number to the amount of returned rows. So far this has worked great. I'm probably going to add more code to handle no records returned although in my case that shouldn't happen but, you never know.
A side note:
If you open the calculated series properties in the designer, you will notice the number of periods is set to "0". If you change this it will overwrite your custom formula in the XML.
Maybe you are looking for
-
Creating a restore image on an external drive with package install options
Hi, I'm looking to use a combination of tools maybe Deploy Studio, System Image Utility etc to create an image that isn't Netbooted but rather on an external drive (a fast Thunderbolt raid enclosure) - a restorable image which will contain OSX setup
-
Freeing connections in a connection pool
I am using WLS8.1.2 on IA64 with jrockit 8.1.2. I have created a connection pool using Microsoft's type 4 non-xa jdbc driver fpr SQLServer2000. My application performs a number of db operations, then using the retrieved information, makes a call to a
-
Wrong Excise is calculated in Billing Document VF01 , pL HELP
Dear All , I have created a billing doc for a STO , now my price of 1 ton is Rs 57328.94 & in billing the Con for exc is JEXP it is for,14 % but the exc cal culating as Rs 8329.61 , instead of Rs 8026.05 here the wrong cal
-
How do i get the sound to work on my videos i upload from my sprint moment ph on the windows media
I uploaded my all my pictures n videos but the videos will not play any sound on the laptop. i just bought this yesterday so i don't kknow what to do to get it to work
-
GROUP BY in Desktop Intelligence
Question: Is there a way to use GROUP BY statement at the Universe level? Detailed Example: I have Cricket Teams and Team Members. I want to display all the team members for a team in a single cell as comma separated values. At database level, I can