Troubleshooting Filtered Data


  • If you are filtering your data in an SQL statement, you will be filtering it through the WHERE statement, as shown here:
SELECT ORDERID, ORDERDATE, ORD_AMOUNT
FROM Orders
WHERE ORDERDATE >= '1/1/2020'
  • When the query is executed,
    • this code will only show the data that meets the specific requirements you set in the WHERE statement
  • When you hardcode a filter into a WHERE statement,
    • it will always show only the data indicated with the filter
    • can be a source of issues
  • Use calculations instead of hardcoded values where possible
    • e.g., for dates use a calculation for current year
WHERE ORDERDATE > DATEADD(year, -1, GETDATE())
  • incorrectly joined data can still send data to the filter,
    • but the filter will not apply to the data
  • When working with multiple tables, you will want to confirm the joins are correct
  • When a filter doesn’t work
    • track the source of that filter and ensure that it is correctly connected to the data set it is trying to filter
  • users might report that data is missing when, in fact, its been filtered out
    • but a filter isn’t always to blame
      • the data wasn’t showing from the start
      • data could be excluded because of a join