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

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
pedrohenriqueperna
Creator III
Creator III

Problems counting intervals from interval table

Hi

I added to my sales fact table a field that has the days difference between the last and last but one purchases by customer.  On other hand I have a intervalmatch link table that gets the days difference as a argument and holds the lower and upper bound for different intervals name/title:

LinkTable_IntervalReturn:
IntervalMatch(customer_days_difference)
LOAD Distinct
customer_return_lowerbound,
customer_return_upperbound
Resident IntervalReturn;

 

The tables seem to be linked just fine, except the days difference values are duplicates for every sale_id that has more than a product sold since I joined the days difference before by using sale_id.

It's not actually supposed to be a problem as I could Aggr and count distinct sale_ids by intervals and customers_id, and that's exactly what I'm trying to do. I can count the occurencies of a certain interval successfully with this expression:

Aggr(Count(Distinct sale_id), interval_return,  customer_id)

 

But when I try to divide it by the total sales counting to find out the return rate % by days/interval, it only returns a value to the first interval, although the value is correct.

 

What am I missing?

 

This is the expression for intervals count / sales count:

Aggr(Count(Distinct sale_id),  customer_id,  interval_return)
/
Aggr(Count(Distinct {$<valid_sale_flag = {"V"}>} sale_id), customer_id)

PS: If I filter a specific interval by name through set analysis, it returns the correct value but only for that interval aswell...

 

f15c0963747b8d2bafba0e2a0dec9f70.png

Labels (2)
0 Replies