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

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,089,391
Messages
5,407,970
Members
403,175
Latest member
Zaibass

This Week's Hot Topics

  • help please
    SORRY NOT ANY GOOD AT EXCEL SO HELP WOULD BE MUCH APPRECIATED this formula is in a sheet called ignore...
  • two formulas needed
    Hello, I'll try my best to explain this: First formula needed in Sheet1 cell A2: If Sheet1 cell B2 = Sheet2 cell B2 then return a 1. If not then...
  • Dynamic Counts
    Good afternoon, we are tidying up some data & the data seems to be growing quicker than we are tidying it up! What we confirm (by reviewing it...
  • Help Excel formula eliminate duplicate values and keep only 2 identical rows.
    as picture below column A has a duplicate value. but the values are not the same as the rule. sometimes 4 rows, sometimes 10 rows or 7 or 9...
  • Macro Compile Error Sub or Function not defined
    Hello, I am trying to run macros from a validation list, all macros have been created and run perfectly on there own but I'm getting a compile...
  • Last row combined with Current Region VBA
    I'm generally happy finding the last row of data through something like Lastrow = Cells(Rows.Count, "D").End(xlUp) but I don't always receive data...
Top