Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm struggling with an expression that is used in a graph that shows the cumulative number of purchasing users over the course of weeks.
I want to have only users that have completed a purchase. This information is joined into the main table with a separate query, which sets value 'Yes' for all distinct users that have made a purchase.
I want to show each user only once in the graph, even if they had made purchases on several weeks. On every other graph I have successfully used {<HasPurchased={'Yes'}>} to include only purchasing customers, but for some reason this cumulative function seems to ignore any set expressions I 'm making.
If I set a filter HasPurchased = 'Yes' manually, I can see the correct numbers.
Here's my function:
rangesum( above( Count(Aggr(distinct {<HasPurchased={'Yes'}>}CustomerID,CustomerID)),0,rowno()))
Hi
Try this
Aggr({<HasPurchased={'Yes'}>}>}RangeSum(Above(Total Count(distinct CustomerID) + Sum({1} 0), 0, RowNo(Total))), ([OrderID]),HasPurchased)
Hope this helps
Thanks
Have you tried the expression without the Aggr?
rangesum(above(Count({<HasPurchased={'Yes'}>} distinct CustomerID), 0, rowno()))
If you believe that you need the Aggr(), you will need to add the chart dimension to the dimensions for the Aggr():
rangesum(above(Count(Aggr(distinct {<HasPurchased={'Yes'}>} CustomerID, CustomerID, WeekNo)), 0, rowno()))
Replace WeekNo with the correct dimension field name.
I tried this but for some reason this and the other expression return values that are too big, by ~10%.
I created an AsOf table (https://community.qlik.com/t5/Qlik-Design-Blog/The-As-Of-Table) and now I have the correct figures, the only problem with this is that I haven't really understood how it works and for now have to just trust it does.
I haven't really understood Aggr either so it seems there's a lot of new things to figure out. Thank you for your reply in any case, it's great to know there's an active community that's there to help.