Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to Sum in script with IF

Hiya All

I am trying to Sum a Field base don IF can you guys help

if transtype - 1 Sum (Transtype) as T1

if transtype - 1 Count (Transtype) as T2


Can anyone help please?


Thanks

1 Solution

Accepted Solutions
Mark_Little
Luminary
Luminary

Hi,

If you are doing this in script it will be some from of aggregation. something like

Load

     ...

     SUM(transtype)  as T1,

     Count(transtype) as T2

Resident 'Your Table'

Where transtype = 1

Group by FIELD;

Mark

View solution in original post

5 Replies
PrashantSangle

Hi,

Need more explanation..

Provide some data..

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
sunny_talwar

What is the condition here? May be something like this:

Sum(If(Condition = Something, Transtype)) as T1,

Count(If(Condition = Something, Transtype)) as T1,

Anonymous
Not applicable
Author

try like this?

If(transtype=1, sum(transtype)) as T1

If(transtype=1, Count(transtype)) as T1

Mark_Little
Luminary
Luminary

Hi,

If you are doing this in script it will be some from of aggregation. something like

Load

     ...

     SUM(transtype)  as T1,

     Count(transtype) as T2

Resident 'Your Table'

Where transtype = 1

Group by FIELD;

Mark

sujeetsingh
Master III
Master III

Add column

Sum(If(Condition = Something, Transtype)) as T1,

Count(If(Condition = Something, Transtype)) as T1,


While resident load in your script.