Solved Sum Expression columns in query (1 Viewer)

tihmir

Registered User.
Local time
Yesterday, 22:23
Joined
May 1, 2018
Messages
216
Hi, is it possible to sum 3 expression columns in query and how to do it?
The expression columns is:
curruntInspection: Sum(IIf([Type] Like "curruntInspection*";1;Null))
targetedInspection: Sum(IIf([Type] Like"targetedInspection*";1;Null))
thematicInspection: Sum(IIf([Type] Like "thematicInspection*";1;Null))

how can I sum them?
Thanks.
 

plog

Banishment Pending
Local time
Today, 00:23
Joined
May 11, 2011
Messages
10,916
A + B + C

Or combine all the IIf statements into 1:


X: SUM( Iif([Type] LIKE "A*" OR [Type] LIKE "B*" OR ...

And in all cases I would replace Null with 0.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:23
Joined
Aug 30, 2003
Messages
35,709
Not sure it's how I'd be setting things up, but something like:

IIf([Type] Like "curruntInspection*" OR [Type] Like "targetedInspection*" OR...
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 13:23
Joined
May 7, 2009
Messages
16,393
TotalInspection: [curruntInspection] + [targetedInspection] + [thematicInspection]
 

tihmir

Registered User.
Local time
Yesterday, 22:23
Joined
May 1, 2018
Messages
216
Thank you very much for the helpful tips, plog, pbaldy, arnelgp.
With plog' s code I solved the task and the problem.
Code:
X: SUM( Iif([Type] LIKE "A*" OR [Type] LIKE "B*" OR ...
You are awesome!
 

Users who are viewing this thread

Top Bottom