Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ecabanas
Creator II
Creator II

How to sum the sales "that contains"

Hi,

I want to calculate

sum({<Fresco_Flag={'1'}>} IMPORTBRUT)

But I want to sum the sales that contains "Fresco_Flag=1" not the sums of Fresco_flags that I did in the script

Many thank's

Eduard

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

=SUM({<orderid = P({1<Fresco_flag = {1}>}orderid)>}amount)

View solution in original post

5 Replies
rustyfishbones
Master II
Master II

Maybe you need to get rid of the single quotes

So try

sum({<Fresco_Flag={1}>} IMPORTBRUT)

ecabanas
Creator II
Creator II
Author

Hi,

Maybe I did not made the question right, I would like to sum of the amount (Importbrut) only the orders that contain this field = 1

Example

orderid    amount    Fresco_flag

a               10          0

a               15          1

b               10          0

b               15          0

c               2            1

Result of the sum= 10+15+2=27

Many thank's

Eduard

rustyfishbones
Master II
Master II

In the example you gave

orderid    amount    Fresco_flag

a               10          0

a               15          1

b               10          0

b               15          0

c               2            1

Result of the sum= 10+15+2=27


should it be


Result of the sum= 15+2=17

MK_QSL
MVP
MVP

=SUM({<orderid = P({1<Fresco_flag = {1}>}orderid)>}amount)

rustyfishbones
Master II
Master II

Hi Eduard,

This works SUM({<Fresco_flag ={1}>}amount)

but you may need to check that the Amount filed contains no spaces

In the script use TRIM(amount) as amount

And then try SUM({<Fresco_flag ={1}>}amount)