In SSRS (SQL Server Reporting Services), providing intuitive parameter options helps users easily filter the data they want. One common scenario is allowing users to toggle between today’s data and yesterday’s data using a simple flag parameter.
In this blog, we’ll cover how to:
- – Create a flag parameter (Today or Yesterday)
- – Use it in SSRS to filter data dynamically
Step 1: Create a Flag Parameter in SSRS
1. Go to Report Parameters
– Right-click Parameters > Add Parameter
– Name it: DayFlag
– Prompt: Select Day
– Data Type: Text
2. Set Available Values
– Use Specify values manually:
– Label: Today, Value: Today
– Label: Yesterday, Value: Yesterday
3. Set a Default Value (Optional)
– Default to Today if needed
Step 2: Write the Dataset Query Using the Parameter
Your dataset should filter data based on the selected flag:
SELECT
SaleID,
Amount,
SaleDate
FROM Sales
WHERE
( @DayFlag = ‘Today’ AND SaleDate = CAST(GETDATE() AS DATE) ) OR
( @DayFlag = ‘Yesterday’ AND SaleDate = CAST(GETDATE() – 1 AS DATE) );
Step 3: Preview the Report
– When users run the report, a dropdown appears prompting them to Select Day
– Based on selection, the report displays relevant data
Best Practices
- – Validate that the data exists for the selected date
- – Use the same pattern for other quick toggles like “This Week” or “Last 7 Days”
Conclusion
Using a flag parameter for filtering Today or Yesterday’s data is a simple and effective way to make your SSRS reports more interactive and user-friendly.
Addend Analytics is a leading Power BI consulting services provider and Microsoft Power BI partners based in Mumbai, India. In addition to Power BI implementations, we specialize in providing end-to-end solutions like Business Central with Power BI to unlock actionable insights. Our expertise also extends to Microsoft Fabric consulting, offering competitive Microsoft Fabric pricing to meet your business needs.
We have successfully delivered Power BI for Manufacturing industry, with real-time Power BI manufacturing dashboards. Having successfully completed over 100 projects across industries such as financial services, banking, insurance, retail, sales, real estate, logistics, and healthcare. Whether you’re exploring Business Central implementation cost or seeking advanced data analytics, Addend Analytics is here to help.Get a free consultation now by emailing us at kamal.sharma@addendanalytics.com.
Authored By:
Rahul Prajapati
Sr. Data Analyst