
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Need more explanation..
Provide some data..
Regards
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 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the condition here? May be something like this:
Sum(If(Condition = Something, Transtype)) as T1,
Count(If(Condition = Something, Transtype)) as T1,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
try like this?
If(transtype=1, sum(transtype)) as T1
If(transtype=1, Count(transtype)) as T1


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Add column
Sum(If(Condition = Something, Transtype)) as T1,
Count(If(Condition = Something, Transtype)) as T1,
While resident load in your script.
