Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Studio: Is it possible to filter on a data item, not a query? 1

Status
Not open for further replies.

ksolutions

Technical User
Feb 8, 2006
15
US
I need to provide data regarding orders by channel. Orders are in [Order Nr] and the channel that they come in on is defined in [Order Channel]. [Order Nr] is the customer's order number, and [Order Channel] can be Online, Phone, Mail, etc.

I can calculate the overall total count of orders as:
total(count(distinct[Order Nr]))

But how do I filter the orders to show only those for Online, Phone, etc - like the following:

if [Order Channel] = 'Online' then total(count(distinct[Order Nr]))

I need to create these calculations in the same query, so I can't filter a query - I need to filter a data item. I will need to add them together later on - that is why they can't be in separate query items.

Is this possible?
 
Hi,

You're so close....

Create the following calculations or data items;

[Online]

if [Order Channel] = 'Online' then total(count(distinct[Order Nr]))
else
0

[Phone]

if [Order Channel] = 'Phone' then total(count(distinct[Order Nr]))
else
0

.
.
.
ETC

Then later on..... [Online]+[Phone]= endless posibilities!!

Hope I read it right....

Nuffsaid.
 
Unfortunately it doesn't work - I keep adding a bunch of parenthesis to fix the problem and finally ended up with this:

if ([Order Channel]='Online') then (total(count(distinct[Order Nr]))) else 0

but I get an error saying "there was a parsing error before or near position: 77, text starting at position: 7 "der Channel]='Online') then (total(count(distinct[Order Nr]))) else 0

Arrrgh! Thanks for your attempt to help :( Got any other ideas?
 
I've found report studio to be "very picky" when it comes to syntax. Your formula looks correct except for the ELSE statement. Try wrapping the zero in () else (0)

Nuffsaid.
 
It works! I ended up with the following:

if ([Order Channel]='Online' ) then
(total(count( distinct [Order Nr]))) else (0)

Thank you so much for your help. You're right, report studio is very picky!

 
I'm glad it worked out for ya.. [2thumbsup]

BTW, thanks for the *, it's my first in this forum.

Nuffsaid.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top