Grouping logic in measure

macfuller

Active Member
Joined
Apr 30, 2014
Messages
319
Office Version
  1. 365
Platform
  1. Windows
I have a measure that I *think* is returning what I want it to, but it's cumbersome and I'm wondering if there's a cleaner way to do this. First, here's the measure:
Code:
Count of UoM Errors:=
    SUMX (
    SUMMARIZE ( 'Match Exception', 'Match Exception'[ME_Key] ),
    CALCULATE (
        MAXX (
            'Match Exception',
            IF ( 'Match Exception'[Vouch UOM] <> 'Match Exception'[PO UOM], 1, 0 )
        )
    )
)

We have vouchers that go into an exception log, and can appear in multiple rows because the voucher violates multiple rules. The ME_Key field above is the unique identifier, so a voucher that violates (say) 3 rules would have 3 rows in the exception log with different violation codes but the same ME_Key value.

I want to count how many vouchers have Unit of Measure errors (e.g. we ordered at a Case (CA) unit but received at a Box (BX) unit). So I want to sum all the instances where [Vouch UOM] <> [PO UOM] but only count it once for each ME_Key value. It seems I should be able to come up with a more elegant solution?
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,223,893
Messages
6,175,240
Members
452,621
Latest member
Laura_PinksBTHFT

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