Pie Chart to Show top5 Collect all others

  • I am using SSRS 2008 working in Visual Studio. I have a pie chart that I need to display the costs for the top 5 units then collect all the others into a single slice. All I have been able to find is how to use a % or a set number. The costs vary across the different groups of equipment. Shot of the chart data attached.

    How do I display the top 5 units and collect the rest into a single slice.

    Thank you,

  • You could use RANK/DENSE RANK in your query and then create a calculated expression in SSRS.

    IIf(PersonRank>5.6,PersonRank)

    then just group on [PersonRank]

  • I would approach this by using the SQL in your report (preferably the stored procedure that the report calls).

    WITH myTop5 as (

    select top 5 customer

    from myTable

    group by customer

    order by sum(salesAmouns) DESC

    )

    SELECT t1.customer, sum(t1.salesAmount) as totalInSales

    from myTable as t1 inner join myTop5 as t2 on t1.customer = t2.customer

    group by t1.customer

    union all

    SELECT 'All the others', sum(salesAmount)

    from myTable t1

    where NOT EXISTS (

    select t2.customer

    from myTop5 as t2

    where t1.customer = t2.customer

    )

    ----------------------------------------------------

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply