# Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

Not applicable

## Basket Analysis-Display 2 measures with combo chart

I have the below sample data..and have created a basket analysis to show each the no. of times each categories are sold with the selected category, the presence of invoiceID indicates the item has been sold.

Session IDInvoiceIDItemIDCategory
11112219DL
11112220E
11112221JL
1111222JL
1111223Q
1111224W
2222213DB
2222211DL
2222212DL
2222219DE
2222220E
2222221JL
2222222JL
3333213DB
3333211DE
3333212DL
3333219DL
3333220E
3333221JL
3620213DB
36201214DB
36201211DL
36201212DL
3620218E
3620216Q
3620217Q
36201215W

For example, when i choose Category E, it shows that DL has been sold with E at one session(1111),and JL has  also been sold with Category E at one session also(1111).

I want to change it to a combo chart to add a line above the bar, the line chart tells the conversion rate of each combination of the selected category and the display category, for example, when i choose E, the value of the line point at DL would be 25%, the value should be calculate with:

the no. of times E and DL are sold together (that would be 1 at the above example) at the same session /the no. of times  E and DL are in the same session(not sold together, in the above example, it would be 4, E and DL have been on session 1111,2222,3333 and 3620), so the values on the data point at DL is 1/4=0.25 (25%).......

How can i achieve this..???

Tags (5)
1 Solution

Accepted Solutions
MVP

## Re: Basket Analysis-Display 2 measures with combo chart

Check the attached may be

=count(DISTINCT {\$<InvoiceID=P(InvoiceID),[Session ID]=p({\$}[Session ID]),Category=E({\$}Category),Flag = {0}>}InvoiceID)/count(DISTINCT {\$<[Session ID]=p({\$}[Session ID]),Category=E({\$}Category)>}[Session ID])

2 Replies
MVP

## Re: Basket Analysis-Display 2 measures with combo chart

Check the attached may be

=count(DISTINCT {\$<InvoiceID=P(InvoiceID),[Session ID]=p({\$}[Session ID]),Category=E({\$}Category),Flag = {0}>}InvoiceID)/count(DISTINCT {\$<[Session ID]=p({\$}[Session ID]),Category=E({\$}Category)>}[Session ID])

Not applicable

## Re: Basket Analysis-Display 2 measures with combo chart

Sunny,

Thank you very much for replying my question.

you solved it in a minute which i struggle for whole day.......

i should spend more time on the p() and e() functions..