Get delta using Previous() in Matrix and Table.
This is My Report Structure.
Country Group
MonthGroup
SurveyQuestionGroup
Data
Delta(Current - Previous Month)
Matrix is inside of Table(for seperate section for Country) and Matrix has Question Group and MonthGroup.
(From my previous posting
HERE
Code from AdvanceWorks and modified as below.
-------
Public Function GetDeltaValue(ByVal PreviousValue, ByVal CurrentValue) As Object
If IsNothing(PreviousValue) Then
Return "No History"
Else
Return Math.Round(CurrentValue,2) - Math.Round(PreviousValue ,2)
End If
End Function
-------
And it worked okay until now.
For example,
Month is 4-6. 4,5,6 will displayed. Survey Question has A and B. Countries I have from beginning are USA and Canada. And I started to use "UK" last
May(5).
Then it will show like this..
Month
4
5
6
Result
Delta
Result
Delta
Result
Delta
Canada
Question A
10
No History
11
1
10
-1
Question B
9
No History
7
-2
9
2
5
6
Result
Delta
Result
Delta
UK
Question A
8
-2
10
2
Question B
10
1
11
1
4
5
6
Result
Delta
Result
Delta
Result
Delta
USA
Question A
12
2
10
-2
9
-1
Question B
9
-2
10
1
9
-1
Colored background should be "No History" but it is calculated the delta using previous table group's last data.
So, I tried to put Inscope for Table group(Country group) and question group as well but it did not work.
Also, I cannot use Inscope() inside Previous() expression.
What is best possible way to sove this issue?
Thank you,
June 17th, 2011 1:04pm
Hi, SoyLover
Thanks for your question. Based on your two threads, I understand that when you using the code in the first column of the Delta, it displays
the incorrect result, for other columns, the result is correct, right? If I misunderstand your question, please let me know.
Since you had added order in the Month group, so we can use the Min() function in the textbox of Delta, if the Month’s value in the current
scope equals to the minimal value of the Month in the Data region level, we can conclude that the current column of Delta is the first column in the Month group, thus we avoid using the code.
Right-clicking the textbox of Delta, select expression, type in the Expression dialog box like this:
=Iif(Fields!Months.Value=Min(Fields!Months.Value,"TablixName"),NO Code,Code).
If you have any other question, please feel free to let me know.
Thanks,
Sharp Wang
Best Regards. Sharp Wang
Free Windows Admin Tool Kit Click here and download it now
June 22nd, 2011 9:01am