Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
3.67/5 (3 votes)
See more:
Dear All,

I have to create Report Like This:
NO |DESC |DATE-1              |DATE.NOW           |INFO
22 |XXXX |val1 | val2 | Total |val1 | val2 | Total |Val1(now-(date-1))| Val2(now-(date-1))| Total(now-(date-1)) | Total(now)/Total(date-1)

My data table like this one :
No	desc	date	        category   value
1	xxx	10/11/2012	a	   1
2	xxx	10/12/2012	b	   2
3	xxx	10/11/2012	a	   3
4	xxx	10/12/2012	b	   4

I have used pivot table on my query to show in gridview, but the result not show all the category,
SQL
Select no, [10/11/2012], [10/12/2012]
From 
(select no, date, category, value from tb_detail) p
Pivot
(
Max (value)
For date in
( 
 [10/11/2012], [10/12/2012]
)
) as pvt
Order by no

And i used pivotgrid, but in info column just show sum of field, not show the calculation like the formula.

What the best way to solve this problem.

Regards,
Chairul
Posted
Updated 20-Oct-12 23:45pm
v4
Comments
Sergey Alexandrovich Kryukov 18-Oct-12 22:27pm    
Please, don't shout (ALL CAPS is considered shouting on the Web; and it irritates many, who consider it rude).
--SA
chairul83 21-Oct-12 3:27am    
Thanks for your suggest Sergey.

I Just change to lowercase, sorry for my english.
Herman<T>.Instance 13-Nov-12 5:45am    
if you read my article about pivotting you get explained while not all results have values

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900