Sum and Count based in a Condition (1 Viewer)

sajarac

Registered User.
Local time
Today, 09:10
Joined
Aug 18, 2015
Messages
126
Hello,

Hope someone can point me in the right direction.

In my report I have several records but only some has a $$ value for the received PO. I would like to 1. Count if the POValue is greater that 1, and 2. sum if the POValue is greater that 1.

Sorry is a silly question but I am stuck
 

CJ_London

Super Moderator
Staff member
Local time
Today, 14:10
Joined
Feb 19, 2013
Messages
16,604
you would use a sum for the count as well

in an aggregate query, group by whatever fields are required and for your count

sum(iif(POValue>1,1,0))

and for the sum

sum(iif(POValue>1,POValue,0))
 

sajarac

Registered User.
Local time
Today, 09:10
Joined
Aug 18, 2015
Messages
126
Hi thank for your prompt reply.

I forgot to tell you one thing:

I would like to sum and count other fields values i.e.

Sum if POValue>1 , Sum Quatity
Count if POValue>1, Count Quantity

is this possible also?
 

CJ_London

Super Moderator
Staff member
Local time
Today, 14:10
Joined
Feb 19, 2013
Messages
16,604
for the sum, just change the field you want to sum

sum(iif(POValue>1,Quantity,0))

However your count requirement makes no sense
 

sajarac

Registered User.
Local time
Today, 09:10
Joined
Aug 18, 2015
Messages
126
Hi, sorry probably that is why I am confused.

I have a report, in that report I have 100 records, but only 15 of them have a PO Received.

at the end of my report I have several fields where I am getting the total of every single column. i.e

Sum[Quantity], Count[Orders]

But I would like to include at the end of the report some fields that tells me if the record has a PO received (value greater than 1) count how many orders and give me the sum of those orders.
 

sajarac

Registered User.
Local time
Today, 09:10
Joined
Aug 18, 2015
Messages
126
I finally got it, and it was thank you to your advice.

Many many many thanks!!!!
 

Users who are viewing this thread

Top Bottom