Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis problem - Trying to find the amount of customers buying something in the last 31 days.

I'm trying to count the number of Customers that have bought a package the last month.


If(AmountGross>=0,If(istext(Package),Count({< max(DateTrans) >= date(today()-31) >}Distinct ConsumerId)))


I have a couple of refunds that's why I need AmountGross >=0.

The reason I'm checking if Packages exist is because I'm reading out a log with both single and package sales.

But this doesn't work.

This expression gives me data on my current filtering, but I only want to know the last month.


If(AmountGross>=0,If(istext(Package),Count(Distinct ConsumerId)))


1 Reply
Not applicable
Author

You have an expression as the left side of your Set Modifier. That must be a field.

You can try something like:

If(AmountGross>=0,If(istext(Package),
Count({<[Consumer Id]={'=Max(DateTrans)>=Date(Today()-31)'}>}
Distinct ConsumerId)))


I'd probably try it with just the Count() function first to make sure that part is working as expected.