Right data from right row
Hi everybody!
I need some support or advice to improve my ability in reporting service. I also need to inform you that I'm a newbie.
The result of data from dataset:
Store Title Age AmountSold
-------------------------------------------------------------
DK New York City Grey sak 12 4
DK New York City Grey sak 16 10
DK New York City Grey sak 34 22
DK New York City For Fun 47 14
DK New York City For Fun 44 14
DK Biloxi Grey sak 12 3
DK Biloxi Grey sak 16 14
DK Biloxi Grey sak 34 18
DK Biloxi For Fun 12 1
DK Biloxi For Fun 11 16
DK Biloxi For Fun 44 16
DK Biloxi For Fun 45 16
DK Los Angeles For Fun 44 22
DK Los Angeles For Fun 49 3
DK Los Angeles My my 9 2
DK Los Angeles My my 17 4
DK Los Angeles My my 23 14
The main criteria is to create a report per store about displaying which has the best selling CD in different age level: <10, 11-20, 21-30, 31-40, 41-50, 50<
The requested of recieving result in the report would be:
DK New York City:
Age Title AmountSold
31-40
------------------------------------
Grey sak 22
DK Biloxi:
Age Title AmountSold
11-20
------------------------------------
Grey sak 17
For Fun 17
41-50
------------------------------------
For Fun 32
DK Los Angeles:
Age Title AmountSold
<10
------------------------
My my 2
11-20
------------------------
My my 4
21-30
------------------------
My my 14
How do I do to make a sum of each sold product based on age? Probably, I need to do it by expressen code.
How do I do to apply and make the the ages in the column based on "<10, 11-20, 21-30, 31-40, 41-50, 50<"?
Sincerely,
Johan
November 15th, 2010 3:45am
HI,
Please provide me more detail for the same.
Amit
Free Windows Admin Tool Kit Click here and download it now
November 15th, 2010 8:51am
Hi Johan,
First, we can add a calculated field to the dataset to get the age level for each record based on the Age field. Please refer to the steps below:
1.
Right click the dataset in the
Report Data pane, select Add Query Field…
2.
In the Dataset Property window, specify the new
Field Name to AgeLevel and the Field Source to the expression like
=Switch(Fields!Age.Value<=10,"<10",
Fields!Age.Value>10 and Fields!Age.Value<=20,"11-20",
Fields!Age.Value>20 and Fields!Age.Value<=30,"21-30",
Fields!Age.Value>30 and Fields!Age.Value<=40,"31-40",
Fields!Age.Value>40 and Fields!Age.Value<=50,"41-50",
Fields!Age.Value>50 and Fields!Age.Value<=50,">50")
Please correct the Age field name in the expression based on field.
After that, a new field AgeLevel is added to the dataset and we can use it as well as other query field. We can use a table and add Row Groups to it by the hierarchy like: Store
-> AgeLevel -> Title. Then use the aggregate function to get the best-selling CD in different age level for each store.
As the picture shows, I have created sample report based on the dataset you posted. If I have something misunderstand, please point out.
The sample report is available at:
http://cid-1e189c82ae92dfd8.office.live.com/self.aspx/.Public/Reporting%20Services/2010111702.rdl
Thanks,
Tony Chain
Please remember to mark the replies as answers if they help and unmark them if they provide no help
November 17th, 2010 3:10am