Hi,
How do i achieve the below in report builder :
1.The dataset is:
create table dummy (vendor varchar(100),model varchar(100),groupcode varchar(100),margin numeric)
insert into dummy VALUES ('A','ABB','1.1',1),('A','ABB','1.1',3),('B','ABB','1.2',2),('A','ABC','1.1',3),('B','BC','2.1',1),('C','BC','1.1',3),('D','BCD','1.2','2'),('E','ABB','2.1','1'),('E','ABC','2.2',4),('C','ABB','1.1',5),('C','ABB','1.2',1)
Calculation for ChangePercent:
ChangePercent(aggregated value or measure)=divide(calculate(count(GroupCode),Margin>1),count(GroupCode),0)
The Change_Percent (yellow) is measure without a group by ,calculated over entire dataset
The detail values underneath are Change_Percent measure calculated by grouping over model.
2.How do i store the rawdata above into a final table so that i get the results in the above image.I am struggling to achieve this using one query in sql to be usable for SSRS.
Used the below queried to get summary and detail values:
Grouped by model: select model,coalesce(cast(count(case when Margin>1 then [GROUPCODE] else null end) as float)/cast(count([GROUPCODE]) as float),0) PERCCHANGE from DUMMY group by model
No group by : select coalesce(cast(count(case when Margin>1 then [GROUPCODE] else null end) as float)/cast(count([GROUPCODE]) as float),0) PERCCHANGE from DUMMY
Pls help.