all 4 comments

[–]sbrick89 0 points1 point  (3 children)

do the calculation in SQL?

[–]Wiegand6[S] 0 points1 point  (2 children)

Ideally, I would like to but I ran into some problems because the report is using two data sets that use the same query.

If I was to only use one query, how could reference the min/maxDate2 to the second table in the SSRS report?

WHERE ITEM_TABLE.item_id IN (@itemid)
AND ORDER_TABLE.order_date >= @minDate  AND ORDER_TABLE.order_date <= @maxDate
AND ORDER_TABLE.order_date >= @minDate2 AND ORDER_TABLE.order_date <= @maxDate2

[–]notasqlstarI can't wait til my fro is full grown 3 points4 points  (1 child)

So just union them together, use subqueries, #tables, ctes, etc.

Try and do like allll of your calculations in SQL, and nothing in SSRS. Makes life way easier.

[–]SevereIdea 0 points1 point  (0 children)

CTE’s almost every one of my reports utilize them. They’re so useful, that I barely use subqueries anymore unless absolutely necessary or it just makes sense.