Grouping logic in measure

macfuller

Active Member
Joined
Apr 30, 2014
Messages
257
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?
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Watch MrExcel Video

Forum statistics

Threads
1,089,961
Messages
5,411,527
Members
403,375
Latest member
vba33

This Week's Hot Topics

Top