MrAnderson
New Member
- Joined
- Mar 6, 2014
- Messages
- 6
Hi,
I’m trying to count the number of instances where a customer has bought 2 particular products in the same invoice. Let’s assume I have the following table called "invoices.
<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]01/01/2012[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]100[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]01/01/2012[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]50[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]02/02/2012[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]100[/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]02/02/2012[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]25[/TD]
[TD="align: center"]6[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]03/03/2012[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]100[/TD]
[TD="align: center"]7[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]03/03/2012[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]50[/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]03/03/2012[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]25[/TD]
</tbody>
The result I want is the following
<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]0[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]1[/TD]
</tbody>
I have tried with the CALCULATE function with these formulae:
=calculate(distinctcount(Invoices[InvoiceId],Invoices[ProdId]=1;Invoices[ProdId]=2)
Or
=calculate(distinctcount(Invoices[InvoiceId],Invoices[ProdId]=1&&Invoices[ProdId]=2)
but I get no results, can anyone give a hand?
thanks a lot!.
I’m trying to count the number of instances where a customer has bought 2 particular products in the same invoice. Let’s assume I have the following table called "invoices.
A | B | C | D | E | |
---|---|---|---|---|---|
InvoiceId | InvoiceDate | ProductID | Price | ProductName | |
a | |||||
b | |||||
a | |||||
d | |||||
a | |||||
b | |||||
e |
<colgroup><col style="width: 25pxpx"><col><col><col><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]1[/TD]
[TD="align: center"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]01/01/2012[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]100[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]01/01/2012[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]50[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]02/02/2012[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]100[/TD]
[TD="align: center"]5[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]02/02/2012[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]25[/TD]
[TD="align: center"]6[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]03/03/2012[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]100[/TD]
[TD="align: center"]7[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]03/03/2012[/TD]
[TD="align: right"]2[/TD]
[TD="align: right"]50[/TD]
[TD="align: center"]8[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]03/03/2012[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]25[/TD]
</tbody>
Facturas
The result I want is the following
H | I | |
---|---|---|
Jan | ||
Feb | ||
March |
<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
[TD="align: center"]2[/TD]
[TD="align: right"]1[/TD]
[TD="align: center"]3[/TD]
[TD="align: right"]0[/TD]
[TD="align: center"]4[/TD]
[TD="align: right"]1[/TD]
</tbody>
Facturas
I have tried with the CALCULATE function with these formulae:
=calculate(distinctcount(Invoices[InvoiceId],Invoices[ProdId]=1;Invoices[ProdId]=2)
Or
=calculate(distinctcount(Invoices[InvoiceId],Invoices[ProdId]=1&&Invoices[ProdId]=2)
but I get no results, can anyone give a hand?
thanks a lot!.