Search code examples
reporting-servicesssrs-2008ssrs-2008-r2ssrs-2012ssrs-tablix

Set expression for hidden ssrs


I want to display only first 10 rows and hide remaining rows in a column.

what will be the expression for this (Set expression for: Hidden) in Tablix properties -> visibility -> show or hide based on expression.

My dataset name is Top50CustomerSQL; My Column name is Supplier;

Expression for this scenario please?

SQL Code

   SELECT  s.[CusNo] Supplier, 
RTRIM(CAST(s.[Customer] AS VARCHAR(50)) ) AS Name,
s.[ConcessionNo] Concession, 
RTRIM(CAST(s.[ConcessionName] AS VARCHAR(50)) ) AS ConcessionName,

sum(case when s.Date between convert(date,dateadd(wk, datediff(wk, 0, getdate()) - 1, 0) - 1) and convert(date,dateadd(wk, datediff(wk, 0, getdate()) - 1, 0) + 5) 
           then s.SELLINC else 0 end) ActualSales,

    sum(case when s.Date 
        BETWEEN         
             convert(varchar(10), DATEADD(day, DATEDIFF(day, '19000107', DATEADD(month, DATEDIFF(MONTH, 0, CONVERT(date, CONVERT(VARCHAR(4), (CASE WHEN MONTH(GetDate()) = 1 THEN CONVERT(VARCHAR(4), GetDate(), 112) - 1 ELSE CONVERT(VARCHAR(4), GetDate(), 112) END), 112) + '0101')), 30)) / 7  * 7, '19000107'), 120)
        AND        
             Convert(date, dateadd(wk, datediff(wk, 0, GETDATE()) - 1, 0) + 5)       
           then s.SELLINC else 0 end) YrToDateActual


FROM [dbo].[CustomerReports] s
WHERE s.BRN = 1 or s.BRN = 2 or s.BRN = 3 or s.BRN = 4 or s.BRN = 5  or s.SELLINC is null or s.SELLINC = '0'
GROUP BY s.[CusNo], s.[Customer], s.ConcessionNo, s.ConcessionName
order by YrToDateActual desc

Solution

  • You can use RunningValue() to count how many rows have been shown so far in your report. A query like this should work in your group (or details) visibility expression:

    =RunningValue(Fields!Supplier.Value, Count, "DataSet1") > 10
    

    The answer by Neil Norris should be equally valid, assuming you're able to edit your dataset SQL.