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:
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?
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?