Measure to identify based on criteria

one3nine0

Board Regular
Joined
Jul 21, 2014
Messages
127
I have a table in powerpivot showing invoices, and two calculated columns to identify Product A (1) or Product B (2)

[TABLE="width: 500"]
<tbody>[TR]
[TD]Invoice[/TD]
[TD]Product[/TD]
[TD]Units[/TD]
[TD]Price[/TD]
[TD]Calculated Column 1[/TD]
[TD]Calculated Column 2[/TD]
[/TR]
[TR]
[TD]100[/TD]
[TD]A[/TD]
[TD]1[/TD]
[TD]100[/TD]
[TD]True[/TD]
[TD]False[/TD]
[/TR]
[TR]
[TD]100[/TD]
[TD]B[/TD]
[TD]1[/TD]
[TD]50[/TD]
[TD]False[/TD]
[TD]True[/TD]
[/TR]
[TR]
[TD]101[/TD]
[TD]C[/TD]
[TD]1
[/TD]
[TD]100[/TD]
[TD]False[/TD]
[TD]False[/TD]
[/TR]
[TR]
[TD]101[/TD]
[TD]A[/TD]
[TD]1[/TD]
[TD]100[/TD]
[TD]True[/TD]
[TD]False[/TD]
[/TR]
[TR]
[TD]101[/TD]
[TD]D[/TD]
[TD]1[/TD]
[TD]25[/TD]
[TD]False[/TD]
[TD]False[/TD]
[/TR]
[TR]
[TD]102[/TD]
[TD]B[/TD]
[TD]1[/TD]
[TD]50[/TD]
[TD]False[/TD]
[TD]True[/TD]
[/TR]
[TR]
[TD]102[/TD]
[TD]A[/TD]
[TD]1[/TD]
[TD]100[/TD]
[TD]True[/TD]
[TD]False[/TD]
[/TR]
[TR]
[TD]102[/TD]
[TD]C[/TD]
[TD]1[/TD]
[TD]100[/TD]
[TD]False[/TD]
[TD]False[/TD]
[/TR]
</tbody>[/TABLE]

I want to be able to write a measure that will identify if each invoice has both "True" in calculated columns 1 and 2.

That way when I pivot it out, I can see the invoice number, products bought, total spend, and if a true/false if the invoice has both products A and B.

Any Suggestions?
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Code:
=IF(
    CONTAINS (
        Table, 
        Table[Product],
        "A"
    ) &&
    CONTAINS (
        Table, 
        Table[Product],
        "B"
    ),
    "Yes",
    "No"
)
 
Last edited:
Upvote 0
Thanks this works exactly how I asked!

I unfortunately now know I forgot to include details to my question because it did not work they way I wanted.

So the measure works perfectly if I pivot based on invoice number.

The problem, is that I need to get down to the products bought as well. But if I add products to the pivot table, the "Criteria" measure shows No for everything.

Is there a way to include products to the table, but the criteria only answer on the invoice level?
 
Upvote 0
Wrap the previous measure in a CALCULATE with second parameter as an ALLEXCEPT on Invoice.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top