Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Modernize Your QlikView Deployment webinar, Nov. 3rd. REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator III
Creator III

Set Analysis with aggregated function?

I have a table of customers who have bought things, and some of whom have returned things for a refund.  I want to count the number of customers who have a net positive transaction value;

Row Number        Customer      Transaction Value

    1                    CustomerA    $1000

    2                    CustomerA    -$1000

    3                    Customer B    $500

Should give the answer "One Customer"

Count(Distinct {<[Transaction Value] = {">0"}>} [Customer] ) will give the answer "2" because it will count Row 1 & Row 3.

I have tried Count(Distinct {<Aggr (Sum ([Transaction Value])) = {">0"}>} [Customer] ) but that gives an error in the formula editor.

I also tried, Count(Distinct {<'Sum ([Transaction Value]) >0'>} [Customer] ) which is accepted, but gives the wrong answer (I think it just counts all records

Any clues???

Thanks.

1 Solution

Accepted Solutions
Highlighted

Try this

Count(DISTINCT {<Customer = {"=Sum([Transaction Value]) >0"}>} Customer)

View solution in original post

4 Replies
Highlighted

Try this

Count(DISTINCT {<Customer = {"=Sum([Transaction Value]) >0"}>} Customer)

View solution in original post

Highlighted
Creator III
Creator III

That works a treat, thanks!

Highlighted

Done

Highlighted
Contributor
Contributor

what if i want a range here e.g my expression is: Count(DISTINCT {<[KYSC.FLOAT_DAY] = {"=AVG([KYSC.FLOAT_DAY])>=0"}>} [KYSC_SALE_CHNL_CD])

also does it work with avg?

my range is AVG([KYSC.FLOAT_DAY])>=0<1.

thanks.

Wajiha