Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Most frequent table value for a dimension

Hi all,

I have a table like:

Customer | Item | item category | price | qty

I would like to get as result something like

Cutomer (as a dimension) | Turnover (as qty * price) | most frequent ordered category

The result is provided through a table drawn as a chart.

and I don't have any idea on how to turn the expression to get that "most frequent ordered category"

Any idea?

Thanks in advance for your usual support

7 Replies
Not applicable
Author

I think i found the answer mode()

Not applicable
Author

The mode() fonction seems not to work properly, in a specific case I have an item_category that is equal to null and the customer order more than 10 items (on a total of 15) from a category "A" and QV returns "null" as the result of mode()

Nicole-Smith

Try something like this:

if(item_category <> NULL(), mode(item_category))

sivarajs
Specialist II
Specialist II

do something like aggr(max(category),customer)

Not applicable
Author

Thank you both but unfortunatly it does not work.

I extracted 3 cases where I have a wrong answer with the mode() function:

Customer Order IdItemItem CategroryPrice
CUST A72310Product 1-150,11
CUST A72310Product 2-145,29
CUST A73910Product 3CAT B48,16
CUST A73910Product 4CAT D165,13
CUST A73910Product 5CAT E21,58
CUST A73910Product 6CAT B36,14
CUST A73910Product 7CAT B86,19
CUST A73910Product 8CAT A71,24
CUST A73910Product 9CAT B18,97
CUST A88280Product 10CAT D229,14
CUST A88280Product 11CAT D130,36
CUST B89974Product 12CAT B9,86
CUST B89974Product 13CAT B13,96
CUST B89974Product 14CAT B5,64
CUST B89974Product 15CAT B12,68
CUST B89974Product 16CAT B21,14
CUST B89974Product 17CAT B33,72
CUST B89974Product 18CAT B8,22
CUST B89974Product 19CAT C47,53
CUST B89974Product 20CAT C59
CUST B89974Product 21CAT B17,52
CUST B89974Product 22CAT C48,72
CUST B89974Product 23CAT C62,61
CUST B89974Product 24CAT C45,37
CUST B89974Product 25CAT B11,74
CUST B90854Product 26CAT C82,8
CUST B90854Product 27CAT C75,61
CUST B90854Product 28CAT C86,4
CUST B90854Product 29CAT C93,61
CUST C89380Product 30CAT B12,62
CUST C89380Product 31CAT B43,13
CUST C89380Product 32CAT A20,32
CUST C89380Product 33CAT B20,27
CUST C89380Product 34CAT B19,68
CUST C89380Product 35CAT B6,79
CUST C89380Product 36CAT B12,18
CUST C89380Product 37CAT B10,79
CUST C89380Product 38CAT B23,47
CUST C89380Product 39CAT B7,39
CUST C89380Product 40CAT B12,18
CUST C89380Product 41CAT B13,49
CUST C89380Product 42CAT A20,37
CUST C89380Product 43-23,99
CUST C89380Product 44CAT B34,89
CUST C89380Product 45CAT A62,81
CUST C89380Product 46CAT B17,52
CUST C89380Product 47CAT A10,89

For Cust B i can understand as frequence for CAT B and CAT C is equal to 9

But for Cust C, I would have Cat B (freq=13 vs 4 or 1) and for Cust A the result should be Cat B (freq 4 vs 1,1,3,2)

Nicole-Smith

Can your post your .qvw and some data so that we can see it?

ToniKautto
Employee
Employee

If more than one value is equally commonly occurring NULL is returned.