Solved Sum Expression columns in query (1 Viewer)

tihmir

Registered User.
Local time
Today, 05:34
Joined
May 1, 2018
Messages
257
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, 07:34
Joined
May 11, 2011
Messages
11,613
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
Today, 05:34
Joined
Aug 30, 2003
Messages
36,118
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, 20:34
Joined
May 7, 2009
Messages
19,175
TotalInspection: [curruntInspection] + [targetedInspection] + [thematicInspection]
 

tihmir

Registered User.
Local time
Today, 05:34
Joined
May 1, 2018
Messages
257
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