Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

aggr function with rangesum(before()) not working

Dear all,

anyone can help me why this function doesn't return any value?

exp :

sum(

    Aggr(

        if(RangeSum(Before(if(sum(SALES_VALUE_GROSS)>0,1),0,3))=3,1)

        ,CUSTOMER_ID

    )

)

thanks

Labels (1)
5 Replies
khadeer
Specialist
Specialist

Try this

Aggr(

    sum(

        if(RangeSum(Before(if(sum(SALES_VALUE_GROSS)>0,1),0,3))=3,1))

        ,CUSTOMER_ID

    )

er_mohit
Master II
Master II

hey plz clarify what's  you actually want in output. i didn't get you exactly

Not applicable
Author

hi

i think you miss this

sum( )CUSTOMER_ID

Not applicable
Author

i'm sorry..it's still not working..i clarify in a moment..

thanks..

Not applicable
Author

thanks to all for fast response..

here is my little problem..

i want to count CUSTOMER_ID which have transaction for the last 3 months..it said Loyal Customer..

if the customer_id doesn't have 3 transactions..it's not counted..

because count(if can not be used..so i try to manipulate using sum(aggr(rangesum(..which sometime working..but this case not..

1st exp :

     if(sum(SALES_VALUE_GROSS)>0,1,0)

2nd exp :

     RangeSum(Before(if(sum(SALES_VALUE_GROSS)>0,1),0,3))

3rd exp :

     if(RangeSum(Before(if(sum(SALES_VALUE_GROSS)>0,1),0,3))=3,1)

4th exp :

sum(

    Aggr(

        if(RangeSum(Before(if(sum(SALES_VALUE_GROSS)>0,1),0,3))=3,1)

        ,CUSTOMER_ID

    )

)

as everyone see..the 4th exp is just summary the 3rd exp..but unfortunately it is not working..

thanksloyal customer.png